json-stable-stringify
- Version 1.2.0
- Published
- 34 kB
- 5 dependencies
- MIT license
Install
npm i json-stable-stringify
yarn add json-stable-stringify
pnpm add json-stable-stringify
Overview
deterministic JSON.stringify() with custom sorting to get deterministic hashes from stringified results
Index
Functions
Type Aliases
Functions
function stableStringify
stableStringify: ( obj: object, options?: | (stableStringify.Comparator & stableStringify.StableStringifyOptions) | stableStringify.StableStringifyOptions) => string | undefined;
Type Aliases
type Comparator
type Comparator = ( a: { key: string; value: unknown }, b: { key: string; value: unknown }, getter: Getter) => number;
type Getter
type Getter = { get(key: Key): unknown };
type Key
type Key = string | number;
type Node
type Node = unknown[] | NonArrayNode;
type NonArrayNode
type NonArrayNode = Record<Key, unknown>;
type StableStringifyOptions
type StableStringifyOptions = { cmp?: Comparator; cycles?: boolean; replacer?: (this: Node, key: Key, value: unknown) => unknown; space?: string | number;};
Package Files (1)
Dependencies (5)
Dev Dependencies (15)
Peer Dependencies (0)
No peer dependencies.
Badge
To add a badge like this oneto your package's README, use the codes available below.
You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/json-stable-stringify
.
- Markdown[![jsDocs.io](https://img.shields.io/badge/jsDocs.io-reference-blue)](https://www.jsdocs.io/package/json-stable-stringify)
- HTML<a href="https://www.jsdocs.io/package/json-stable-stringify"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>
- Updated .
Package analyzed in 1837 ms. - Missing or incorrect documentation? Open an issue for this package.