Convert a hexadecimal string to a number. This verifies that the string is a
valid hex string, and that the resulting number is a safe integer. Both
"0x"-prefixed and unprefixed strings are supported.
To convert a hexadecimal string to a bigint instead, use
hexToBigInt.
Convert a hexadecimal string to a number. This verifies that the string is a valid hex string, and that the resulting number is a safe integer. Both "0x"-prefixed and unprefixed strings are supported.
To convert a hexadecimal string to a
bigint
instead, use hexToBigInt.Example
Returns
The number.
Throws
If the value is not a valid hexadecimal string, or if the resulting number is not a safe integer.