json-custom-numbers

v3.1.1
JSON parser and stringifier for custom numbers (e.g. BigInt)
json parse stringify numbers bigint custom lossless performance conformance and 2 more...

test

npm run compile && node test/test.mjs

testPerf

npm run compile && node test/test.mjs --perf-only

testConf

npm run compile && node test/test.mjs --conf-only

trace

npm run compile && node --trace-opt --trace-deopt test/perfTrace.mjs

buildCjs

esbuild src/*.mjs --platform=neutral --target=es2015 --minify --keep-names --line-limit=80 --outdir=. --format=cjs --out-extension:.js=.js

buildEsm

esbuild src/*.mjs --platform=neutral --target=es2015 --minify --keep-names --line-limit=80 --outdir=. --format=esm --out-extension:.js=.mjs && npm run copyTypes

copyTypes

echo '// DO NOT EDIT: automatic copy of index.d.ts' > index.d.mts && cat index.d.ts >> index.d.mts

compile

npm run compileParse && npm run compileStringify

compileParse

sed '/<cut>/,/<\/cut>/d' src/parse.ts | esbuild --loader=ts --define:go=0 --define:ok=1 --define:firstokey=2 --define:okey=3 --define:ocolon=4 --define:ovalue=5 --define:ocomma=6 --define:firstavalue=7 --define:avalue=8 --define:acomma=9 --define:tab=9 --define:newline=10 --define:cr=13 --define:space=32 --define:quote=34 --define:comma=44 --define:minus=45 --define:colon=58 --define:opensquare=91 --define:closesquare=93 --define:backslash=92 --define:f=102 --define:n=110 --define:t=116 --define:u=117 --define:openbrace=123 --define:closebrace=125 --define:badChar=65536 > src/parse.mjs

compileStringify

esbuild src/stringify.ts --outfile=src/stringify.mjs

build

tsc --noEmit && npm run testConf && npm run buildCjs && npm run buildEsm
npm i json-custom-numbers

Metadata

  • MIT
  • Whatever
  • George MacKerron
  • released 1/12/2024

Downloads

Maintainers