Closed rauschma closed 1 year ago
const intToBigInt = (key, val, {source}) => typeof val === "number" && val % 1 === 0 ? BigInt(source) : val;
AFAICT, this code is going to fail for (e.g.) source === '123e2':
source === '123e2'
> BigInt('123e2') SyntaxError: Cannot convert 123e2 to a BigInt
intToBigInt is intended to illustrate a particular example rather than completeness, but I understand the risk of developers naïvely copying code off the Internet. Does #38 satisfy your concerns?
intToBigInt
Looks good, yes!
AFAICT, this code is going to fail for (e.g.)
source === '123e2'
: