NewYour coding agent can read the release notes before it upgrades.Set up the MCP server →
npm · #941 most downloaded on npm
Deterministic and safely JSON.stringify to quickly serialize JavaScript objects
Last release 2 years ago
no release in 18 months
Release timing varies
gaps range from 2 weeks to 1.6 years
Nearly every release is documented
notes for 12 of 13 stable releases
Nothing withdrawn
no release was ever pulled
9 years old
13 releases · first in 2018
Accept Array#sort(comparator) comparator method as deterministic option value to use that comparator for sorting object keys.
Array#sort(comparator) comparator method as deterministic option value to use that comparator for sorting object keys.import { configure } from 'safe-stable-stringify'
const object = {
a: 1,
b: 2,
c: 3,
}
const stringify = configure({
deterministic: (a, b) => b.localeCompare(a)
})
stringify(object)
// '{"c": 3,"b":2,"a":1}'Thanks to @flobernd, @cesco69 and @prisis to contribute to this release!
One column per quarter.
Fixed toJSON function receiving array keys as number instead of string
More precise TypeScript replacer type.
More precise TypeScript types. The return type is now either string , undefined or string | undefined depending on the input.
string, undefined or string | undefined depending on the input.Added strict option to verify that the passed in objects are fully compatible with JSON without removing information. If not, an error is thrown.
strict option to verify that the passed in objects are fully compatible with JSON without removing information. If not, an error is thrown.Fix invalid regexp group error in browsers or environments that do not support the negative lookbehind regular expression assertion.
Accept the Error constructor as circularValue option to throw on circular references as the regular JSON.stringify would:
Error constructor as circularValue option to throw on circular references as the regular JSON.stringify would:import { configure } from 'safe-stable-stringify'
const object = {}
object.circular = object;
const stringify = configure({ circularValue: TypeError })
stringify(object)
// TypeError: Converting circular structure to JSONReduce module size by removing the test and benchmark files from the published package
undefined as circularValue option to remove circular properties from the serialized output:import { configure } from 'safe-stable-stringify'
const object = { array: [] }
object.circular = object;
object.array.push(object)
configure({ circularValue: undefined })(object)
// '{"array":[null]}'Added maximumBreadth option to limit stringification at a specific object or array "width" (number of properties / values)
maximumBreadth option to limit stringification at a specific object or array "width" (number of properties / values)maximumDepth option to limit stringification at a specific nesting depth[BREAKING] Convert BigInt to number by default instead of ignoring these values If you wish to ignore these values similar to earlier versions, just u
bigint option and set it to false.Fixed an indentation issue in combination with empty arrays and objects
Fix issue with undefined values (4196f87f16e95c711d1776102d6cc73f1c384431, 4eab558c2ddbf24adb5776e4fc1091aa8673b703)
undefined values (4196f87f16e95c711d1776102d6cc73f1c384431, 4eab558c2ddbf24adb5776e4fc1091aa8673b703)Nothing published for this version
Your coding agent can read these notes before it upgrades. Set up the MCP server →