UNPKG

607 BJavaScriptView Raw
1"use strict";
2Object.defineProperty(exports, "__esModule", { value: true });
3exports.hexHasPrefix = void 0;
4const hex_js_1 = require("../is/hex.js");
5/**
6 * @name hexHasPrefix
7 * @summary Tests for the existence of a `0x` prefix.
8 * @description
9 * Checks for a valid hex input value and if the start matched `0x`
10 * @example
11 * <BR>
12 *
13 * ```javascript
14 * import { hexHasPrefix } from '@polkadot/util';
15 *
16 * console.log('has prefix', hexHasPrefix('0x1234')); // => true
17 * ```
18 */
19function hexHasPrefix(value) {
20 return !!value && (0, hex_js_1.isHex)(value, -1);
21}
22exports.hexHasPrefix = hexHasPrefix;