Add tslint (#151)

This commit is contained in:
Jaco Greeff
2018-06-27 10:15:46 +02:00
committed by GitHub
parent 499a877f15
commit 73477a2809
134 changed files with 989 additions and 884 deletions
+11 -11
View File
@@ -7,17 +7,17 @@ import isString from './string';
const HEX_REGEX = /^0x[a-fA-F0-9]+$/;
/**
@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
*/
* @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
*/
export default function isHex (_value: any, bitLength: number = -1, ignoreLength: boolean = false): _value is string {
const value = (_value as string);
const isValidHex = value === '0x' || (isString(value) && HEX_REGEX.test(value));