big.js icon indicating copy to clipboard operation
big.js copied to clipboard

Nullish input of Big constructor results in Error

Open zerosrat opened this issue 1 year ago • 1 comments

For example, using Big(null) will cause Error: [big.js] Invalid number while it is common that I can't make sure if the input is not nullish value.

I suggest that Big(null) returns value zero and it logs warning in dev mode.

ref: https://github.com/MikeMcl/big.js/blob/master/big.mjs#L138

zerosrat avatar Jul 20 '23 08:07 zerosrat

IMO not a good idea. BigInt, which is newer than Number, throws error: https://github.com/tc39/proposal-bigint/issues/15

andretf avatar Mar 06 '24 01:03 andretf