isHexString
isHexString(
value,length?):boolean
Defined in: utils/bytes.ts:364
Returns true if and only if object is a valid hex string.
If length is specified and object is not a valid DataHexString of length bytes, an InvalidArgument error is thrown.
Same as ethers.utils.isHexString
Parameters
value
any
the value to check whether or not it’s a hex string
length?
number
a length of bytes that the value should be equal to
Returns
boolean
whether the value is a valid hex string (and optionally, whether it matches the length specified)
Examples
isHexString('0x4924');// trueisHexString('0x4924', 4);// false// length of 4 in bytes would mean a hex string with 8 characters