Files
common/docs/util/modules/_is_hex_.md
T
2018-12-21 09:08:40 +00:00

910 B

Functions

isHex

▸ isHex(value: any, bitLength?: number, ignoreLength?: boolean): boolean

Defined in is/hex.ts:25

name: isHex

signature: isHex (value: any, bitLength: number = -1): boolean

summary: Tests for a hex string.

description: Checks to see if the input value is a 0x prefixed hex string. Optionally (bitLength !== -1) checks to see if the bitLength is correct.

example:

import { isHex } from '@polkadot/util';

isHex('0x1234'); // => true
isHex('0x1234', 8); // => false

Parameters:

Name Type Default value
value any -
Default value bitLength number -1
Default value ignoreLength boolean false

Returns: boolean