Home
Docs
GitHub
Pricing
Blog
Log In

Run Sandworm Audit for your App

Get started
Generated on Apr 23, 2024 via pnpm

fast-json-stable-stringify 2.1.0

deterministic `JSON.stringify()` - a faster version of substack's json-stable-strigify without jsonify
Package summary
Share
0
issues
1
license
1
MIT
Package created
24 Oct 2017
Version published
14 Dec 2019
Maintainers
1
Total deps
1
Direct deps
0
License
MIT

Issues

0
This package has no issues

Licenses

MIT License

Permissive
OSI Approved
This is a human-readable summary of (and not a substitute for) the license. Disclaimer.
Can
commercial-use
modify
distribute
sublicense
private-use
Cannot
hold-liable
Must
include-copyright
include-license
1 Packages, Including:
fast-json-stable-stringify@2.1.0
Disclaimer

This deed highlights only some of the key features and terms of the actual license. It is not a license and has no legal value. You should carefully review all of the terms and conditions of the actual license before using the licensed material.

Sandworm is not a law firm and does not provide legal services. Distributing, displaying, or linking to this deed or the license that it summarizes does not create a lawyer-client or any other relationship.

Direct Dependencies

0
All Dependencies CSV
β“˜ This is a list of fast-json-stable-stringify 's direct dependencies. Data on all dependencies, including transitive ones, is available via CSV download.
NameVersionSizeLicenseTypeVulnerabilities

Visualizations

Frequently Asked Questions

What does fast-json-stable-stringify do?

Fast-json-stable-stringify is a deterministic JSON.stringify(), specifically a quicker version of Substack's json-stable-stringify without jsonify. This NPM package enables developers to convert a JavaScript object into a JSON string in a reliable and consistent manner, without changes in the property order impacting the resulting JSON string. It's faster and efficient, making it a preferred choice for sizable JavaScript objects. It's versatile functionality allows for a custom comparison function to be passed in as well, providing developers with more control over the stringification process.

How do you use fast-json-stable-stringify?

To use fast-json-stable-stringify, you'll first need to install it via NPM using the command npm install fast-json-stable-stringify. After installation, use the require function to make it available in your file. Use the following code as an example:

var stringify = require('fast-json-stable-stringify');
var obj = { c: 8, b: [{z:6,y:5,x:4},7], a: 3 };
console.log(stringify(obj)); // Will output: {"a":3,"b":[{"x":4,"y":5,"z":6},7],"c":8}

You can also provide custom comparison functions to determine the order of properties:

var stringify = require('fast-json-stable-stringify');

var obj = { c: 8, b: [{z:6,y:5,x:4},7], a: 3 };
var s = stringify(obj, function (a, b) {
    return a.key < b.key ? 1 : -1;
});
console.log(s); // Results in: {"c":8,"b":[{"z":6,"y":5,"x":4},7],"a":3}

Objects with circular references can also be handled by setting opts.cycles to true.

Where are the fast-json-stable-stringify docs?

For comprehensive documentation on fast-json-stable-stringify, please refer to the official GitHub repository (https://github.com/epoberezkin/fast-json-stable-stringify). The readme file in the repository provides detailed explanation and examples of the different ways to use this NPM package. You'll find basic usage examples, detailed options, and benchmarks for performance review.

All Versions