You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Some numbers which are larger than Number.MAX_SAFE_INTEGER can still be represented accurately as a regular JavaScript number.
In those cases jsonparse will return them as a number, rather than a string.
I'm not sure if that's intentional but I thought it was worth flagging. I was expecting all numbers outside double precision range to be returned as strings. Here's a few examples where this is not happening:
144380449412828603 string
144122580203659657 string
144250504882249760 number
144222334382612875 string
144353568153548541 string
144131338871386780 number
144274369105917272 string
144188125506805060 number
One potential issue that might arise from this is passing the output from jsonparse to BigInt:
Some numbers which are larger than
Number.MAX_SAFE_INTEGER
can still be represented accurately as a regular JavaScript number.In those cases jsonparse will return them as a number, rather than a string.
I'm not sure if that's intentional but I thought it was worth flagging. I was expecting all numbers outside double precision range to be returned as strings. Here's a few examples where this is not happening:
One potential issue that might arise from this is passing the output from jsonparse to
BigInt
:The cause of the issue (if it is indeed considered an issue) is this condition:
jsonparse/jsonparse.js
Line 416 in b2d8bc6
An additional check against
Number.MAX_SAFE_INTEGER
could suffice as a solution, though may not be backwards compatible.The text was updated successfully, but these errors were encountered: