UNPKG

634 BJavaScriptView Raw
1"use strict";
2Object.defineProperty(exports, "__esModule", { value: true });
3exports.stringToHex = void 0;
4const toHex_js_1 = require("../u8a/toHex.js");
5const toU8a_js_1 = require("./toU8a.js");
6/**
7 * @name stringToHex
8 * @summary Creates a hex string from a utf-8 string
9 * @description
10 * String input values return the actual encoded hex value.
11 * @example
12 * <BR>
13 *
14 * ```javascript
15 * import { stringToHex } from '@polkadot/util';
16 *
17 * stringToU8a('hello'); // 0x68656c6c6f
18 * ```
19 */
20function stringToHex(value) {
21 return (0, toHex_js_1.u8aToHex)((0, toU8a_js_1.stringToU8a)(value));
22}
23exports.stringToHex = stringToHex;