canonicalStringify
function canonicalStringify(value): string;Defined in: src/canonical.ts:31
Serialize a JSON value with object keys sorted lexicographically at every
depth. Arrays keep their order; undefined inside objects is dropped exactly
as JSON.stringify would. Throws on non-finite numbers.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
value |
| JsonValue | undefined |
Returns
Section titled “Returns”string
Example
Section titled “Example”canonicalStringify({ b: 1, a: 2 }) === canonicalStringify({ a: 2, b: 1 }); // true