UNPKG

628 BTypeScriptView Raw
1import type { HexString } from '../types';
2export declare const REGEX_HEX_PREFIXED: RegExp;
3export declare const REGEX_HEX_NOPREFIX: RegExp;
4/**
5 * @name isHex
6 * @summary Tests for a hex string.
7 * @description
8 * Checks to see if the input value is a `0x` prefixed hex string. Optionally (`bitLength` !== -1) checks to see if the bitLength is correct.
9 * @example
10 * <BR>
11 *
12 * ```javascript
13 * import { isHex } from '@polkadot/util';
14 *
15 * isHex('0x1234'); // => true
16 * isHex('0x1234', 8); // => false
17 * ```
18 */
19export declare function isHex(value: unknown, bitLength?: number, ignoreLength?: boolean): value is HexString;