web3-utilsFunctionstoNumbertoNumber CallabletoNumber(value: Numbers): number | bigintConverts any given value into it's number representation, if possible, else into it's bigint representation.@exampleconsole.log(web3.utils.toNumber(1));> 1console.log(web3.utils.toNumber(Number.MAX_SAFE_INTEGER));> 9007199254740991console.log(web3.utils.toNumber(BigInt(Number.MAX_SAFE_INTEGER)));> 9007199254740991console.log(web3.utils.toNumber(BigInt(Number.MAX_SAFE_INTEGER) + BigInt(1)));> 9007199254740992nParametersvalue: NumbersThe value to convertReturns number | bigintReturns the value in number or bigint representation
Converts any given value into it's number representation, if possible, else into it's bigint representation.