UNPKG

785 BJavaScriptView Raw
1"use strict";
2
3Object.defineProperty(exports, "__esModule", {
4 value: true
5});
6exports.hexToString = hexToString;
7
8var _toString = require("../u8a/toString");
9
10var _toU8a = require("./toU8a");
11
12// Copyright 2017-2022 @polkadot/util authors & contributors
13// SPDX-License-Identifier: Apache-2.0
14
15/**
16 * @name hexToU8a
17 * @summary Creates a Uint8Array object from a hex string.
18 * @description
19 * Hex input values return the actual bytes value converted to a string. Anything that is not a hex string (including the `0x` prefix) throws an error.
20 * @example
21 * <BR>
22 *
23 * ```javascript
24 * import { hexToString } from '@polkadot/util';
25 *
26 * hexToU8a('0x68656c6c6f'); // hello
27 * ```
28 */
29function hexToString(_value) {
30 return (0, _toString.u8aToString)((0, _toU8a.hexToU8a)(_value));
31}
\No newline at end of file