Gathering detailed insights and metrics for @casual-simulation/fast-json-stable-stringify
Gathering detailed insights and metrics for @casual-simulation/fast-json-stable-stringify
npm install @casual-simulation/fast-json-stable-stringify
Typescript
Module System
Min. Node Version
Node Version
NPM Version
71.8
Supply Chain
98.8
Quality
77.9
Maintenance
100
Vulnerability
100
License
TypeScript (62.14%)
JavaScript (28.65%)
TeX (7.56%)
Vue (1.19%)
CSS (0.27%)
HTML (0.1%)
Shell (0.04%)
SCSS (0.02%)
Dockerfile (0.01%)
Total Downloads
19,214
Last Day
3
Last Week
13
Last Month
58
Last Year
7,757
50 Stars
13,502 Commits
9 Forks
8 Watching
243 Branches
13 Contributors
Minified
Minified + Gzipped
Latest Version
3.1.14-alpha.3661157217
Package Id
@casual-simulation/fast-json-stable-stringify@3.1.14-alpha.3661157217
Unpacked Size
140.99 kB
Size
46.63 kB
File Count
9
NPM Version
lerna/5.1.8/node@v16.18.1+x64 (linux)
Node Version
16.18.1
Cumulative downloads
Total Downloads
Last day
0%
3
Compared to previous day
Last week
-43.5%
13
Compared to previous week
Last month
-74.8%
58
Compared to previous month
Last year
34.2%
7,757
Compared to previous year
No dependencies detected.
Forked from https://github.com/epoberezkin/fast-json-stable-stringify. Changes include converting to TypeScript and adding the ability to indent JSON output.
Deterministic JSON.stringify()
- a faster version of @substack's json-stable-strigify without jsonify.
You can also pass in a custom comparison function.
1var stringify = require('fast-json-stable-stringify'); 2var obj = { c: 8, b: [{ z: 6, y: 5, x: 4 }, 7], a: 3 }; 3console.log(stringify(obj));
output:
{"a":3,"b":[{"x":4,"y":5,"z":6},7],"c":8}
1var stringify = require('fast-json-stable-stringify');
Return a deterministic stringified string str
from the object obj
.
If opts
is given, you can supply an opts.cmp
to have a custom comparison
function for object keys. Your function opts.cmp
is called with these
parameters:
1opts.cmp({ key: akey, value: avalue }, { key: bkey, value: bvalue });
For example, to sort on the object key names in reverse order you could write:
1var stringify = require('fast-json-stable-stringify'); 2 3var obj = { c: 8, b: [{ z: 6, y: 5, x: 4 }, 7], a: 3 }; 4var s = stringify(obj, function (a, b) { 5 return a.key < b.key ? 1 : -1; 6}); 7console.log(s);
which results in the output string:
{"c":8,"b":[{"z":6,"y":5,"x":4},7],"a":3}
Or if you wanted to sort on the object values in reverse order, you could write:
var stringify = require('fast-json-stable-stringify');
var obj = { d: 6, c: 5, b: [{z:3,y:2,x:1},9], a: 10 };
var s = stringify(obj, function (a, b) {
return a.value < b.value ? 1 : -1;
});
console.log(s);
which outputs:
{"d":6,"c":5,"b":[{"z":3,"y":2,"x":1},9],"a":10}
Pass true
in opts.cycles
to stringify circular property as __cycle__
- the result will not be a valid JSON string in this case.
TypeError will be thrown in case of circular object without this option.
With npm do:
npm install fast-json-stable-stringify
To run benchmark (requires Node.js 6+):
node benchmark
Results:
fast-json-stable-stringify x 17,189 ops/sec ±1.43% (83 runs sampled)
json-stable-stringify x 13,634 ops/sec ±1.39% (85 runs sampled)
fast-stable-stringify x 20,212 ops/sec ±1.20% (84 runs sampled)
faster-stable-stringify x 15,549 ops/sec ±1.12% (84 runs sampled)
The fastest is fast-stable-stringify
fast-json-stable-stringify package is a part of Tidelift enterprise subscription - it provides a centralised commercial support to open-source software users, in addition to the support provided by software maintainers.
To report a security vulnerability, please use the Tidelift security contact. Tidelift will coordinate the fix and disclosure. Please do NOT report security vulnerability via GitHub issues.
No vulnerabilities found.
Reason
30 commit(s) and 3 issue activity found in the last 90 days -- score normalized to 10
Reason
no dangerous workflow patterns detected
Reason
license file detected
Details
Reason
packaging workflow detected
Details
Reason
project is fuzzed
Details
Reason
binaries present in source code
Details
Reason
Found 2/24 approved changesets -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
security policy file not detected
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Reason
dependency not pinned by hash detected -- score normalized to 0
Details
Reason
29 existing vulnerabilities detected
Details
Score
Last Scanned on 2025-01-27
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More