Functions

isHex

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

Defined in is/hex.ts:24

name: isHex

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
1
2
3
4

Parameters:

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

Returns: boolean


Last Updated: 2/26/2019, 11:50:54 AM