1 | ;
|
2 |
|
3 | Object.defineProperty(exports, "__esModule", {
|
4 | value: true
|
5 | });
|
6 | exports.hexToString = hexToString;
|
7 |
|
8 | var _toString = require("../u8a/toString");
|
9 |
|
10 | var _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 | */
|
29 | function hexToString(_value) {
|
30 | return (0, _toString.u8aToString)((0, _toU8a.hexToU8a)(_value));
|
31 | } |
\ | No newline at end of file |