json-with-bigint 2.1.2 → 2.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -25,7 +25,7 @@ export const JSONStringify = (data) => {
25
25
  */
26
26
  export const JSONParse = (json) => {
27
27
  const numbersBiggerThanMaxInt =
28
- /(?<=[^\\]":[\[]?|[^\\]":\[.*[^\.\d*])(-?\d{17,}|-?(?:[9](?:[1-9]07199254740991|0[1-9]7199254740991|00[8-9]199254740991|007[2-9]99254740991|007199[3-9]54740991|0071992[6-9]4740991|00719925[5-9]740991|007199254[8-9]40991|0071992547[5-9]0991|00719925474[1-9]991|00719925474099[2-9])))(?=,|\}[^"]|\][^"])/g;
28
+ /(?<=[^\\]":[\[]?|[^\\]":\[.*[^\.\d*])(-?\d{17,}|-?(?:[9](?:[1-9]07199254740991|0[1-9]7199254740991|00[8-9]199254740991|007[2-9]99254740991|007199[3-9]54740991|0071992[6-9]4740991|00719925[5-9]740991|007199254[8-9]40991|0071992547[5-9]0991|00719925474[1-9]991|00719925474099[2-9])))(?=,|\}[^"]?|\][^"])/g;
29
29
  const serializedData = json.replace(numbersBiggerThanMaxInt, `"$1n"`);
30
30
 
31
31
  return JSON.parse(serializedData, (_, value) => {
@@ -1 +1 @@
1
- export const JSONStringify=t=>JSON.stringify(t,((t,n)=>"bigint"==typeof n?n.toString()+"n":n)).replace(/([\[:])?"(-?\d+)n"([,\}\]])/g,"$1$2$3");export const JSONParse=t=>{const n=t.replace(/(?<=[^\\]":[\[]?|[^\\]":\[.*[^\.\d*])(-?\d{17,}|-?(?:[9](?:[1-9]07199254740991|0[1-9]7199254740991|00[8-9]199254740991|007[2-9]99254740991|007199[3-9]54740991|0071992[6-9]4740991|00719925[5-9]740991|007199254[8-9]40991|0071992547[5-9]0991|00719925474[1-9]991|00719925474099[2-9])))(?=,|\}[^"]|\][^"])/g,'"$1n"');return JSON.parse(n,((t,n)=>"string"==typeof n&&Boolean(n.match(/^-?\d+n$/))?BigInt(n.substring(0,n.length-1)):n))};
1
+ export const JSONStringify=t=>JSON.stringify(t,((t,n)=>"bigint"==typeof n?n.toString()+"n":n)).replace(/([\[:])?"(-?\d+)n"([,\}\]])/g,"$1$2$3");export const JSONParse=t=>{const n=t.replace(/(?<=[^\\]":[\[]?|[^\\]":\[.*[^\.\d*])(-?\d{17,}|-?(?:[9](?:[1-9]07199254740991|0[1-9]7199254740991|00[8-9]199254740991|007[2-9]99254740991|007199[3-9]54740991|0071992[6-9]4740991|00719925[5-9]740991|007199254[8-9]40991|0071992547[5-9]0991|00719925474[1-9]991|00719925474099[2-9])))(?=,|\}[^"]?|\][^"])/g,'"$1n"');return JSON.parse(n,((t,n)=>"string"==typeof n&&Boolean(n.match(/^-?\d+n$/))?BigInt(n.substring(0,n.length-1)):n))};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "json-with-bigint",
3
- "version": "2.1.2",
3
+ "version": "2.1.3",
4
4
  "description": "JS library that allows you to easily serialize and deserialize data with BigInt values",
5
5
  "type": "module",
6
6
  "exports": "./json-with-bigint.js",