2.0.0-preview.1.20240416070914.c44d1793aa5363145e8ad70a31a212685967b46d • Published 7 months ago

@solana/fast-stable-stringify v2.0.0-preview.1.20240416070914.c44d1793aa5363145e8ad70a31a212685967b46d

Weekly downloads
-
License
MIT
Repository
github
Last release
7 months ago

fast-stable-stringify

This project is a fork of nickyout/fast-stable-stringify

The most popular repository providing this feature is substack's json-stable-stringify. The intent if this library is to provide a faster alternative for when performance is more important than features. It assumes you provide basic javascript values without circular references, and returns a non-indented string.

Usage:

var stringify = require('fast-stable-stringify');
stringify({ d: 0, c: 1, a: 2, b: 3, e: 4 }); // '{"a":2,"b":3,"c":1,"d":0,"e":4}'

Just like substack's, it does:

  • handle all variations of all basic javascript values (number, string, boolean, array, object, null, Date, BigInt)
  • handle undefined and function in the same way as JSON.stringify
  • not support ie8 (and below) with complete certainty.

Unlike substack's, it does:

  • not implement the 'replacer' or 'space' arguments of the JSON.stringify method
  • not check for circular references

Running tests

npm run test:unit:browser
npm run test:unit:node 
2.0.0-rc.2

8 months ago

2.0.0-rc.3

8 months ago

2.0.0-preview.4

12 months ago

2.0.0-rc.0

11 months ago

2.0.0-rc.1

10 months ago

2.0.0-preview.3

1 year ago

2.0.0-preview.2

1 year ago