Skip to main content
Version: 11.x

Function: isEmptyHex()

isEmptyHex(value): boolean

Defined in: src/utils/num.ts:401

Test if a value is a 0x prefix with no digit after it.

'0x' is hexadecimal in form — it is how an EVM tool writes empty data — but it spells no number : BigInt('0x') throws, isBigNumberish refuses it, and so does every Cairo type.

Parameters​

value​

unknown

the value to test

Returns​

boolean

true for '0x' and '0X', false for anything else

Example​

const result = num.isEmptyHex('0x');
// result = true
const result2 = num.isEmptyHex('0x0');
// result2 = false