1 | ;
|
2 |
|
3 | Object.defineProperty(exports, "__esModule", {
|
4 | value: true
|
5 | });
|
6 | exports.stringToHex = stringToHex;
|
7 |
|
8 | var _toHex = require("../u8a/toHex");
|
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 stringToHex
|
17 | * @summary Creates a hex string from a utf-8 string
|
18 | * @description
|
19 | * String input values return the actual encoded hex value.
|
20 | * @example
|
21 | * <BR>
|
22 | *
|
23 | * ```javascript
|
24 | * import { stringToHex } from '@polkadot/util';
|
25 | *
|
26 | * stringToU8a('hello'); // 0x68656c6c6f
|
27 | * ```
|
28 | */
|
29 | function stringToHex(value) {
|
30 | return (0, _toHex.u8aToHex)((0, _toU8a.stringToU8a)(value));
|
31 | } |
\ | No newline at end of file |