shelving
Version:
Toolkit for using data in JavaScript.
10 lines (9 loc) • 656 B
TypeScript
/**
* Custom JSON.stringify()
* - Not optimised for performance. Optimised for consistency!
* - Allows returned values to be used for fingerprinting values of any type.
* - Non-JSON-friendly values (like `null`, explicit `undefined`, symbols, functions) are converted to `{ $type: "symbol" }` style constructions.
* - Objects with custom `toString()` properties assume that string is useful and return a value like `{ $type: "Date", value: "Wed Feb 24 2021 20:59:57 GMT+0000 (Greenwich Mean Time)" }`
* - Object properties are sorted (by key) before output so they're always consistent.
*/
export declare function serialise(value: unknown): string;