json-bigint
json-bigint copied to clipboard
Plain numbers are incorrectly parsed as BigInt
Supposedly, everything lower or equal to Number.MAX_SAFE_INTEGER should be 'number', but it's not the case. Here's repro:
import JsonBigInt from "json-bigint";
const { parse } = JsonBigInt({
protoAction: "ignore",
useNativeBigInt: true,
});
console.log(parse(JSON.stringify({ foo: Number.MAX_SAFE_INTEGER, bar: 100 })));
yields { foo: 9007199254740991n, bar: 100 }, should be { foo: 9007199254740991, bar: 100 }
Does this issue be resolved? I'm using version 1.0.0
and still got this issue
This issue is resolved inside the repo after this commit, but for some reason author doesn't seem too interested to publish it on npm.