Installation
npm install --save @types/json-stringify-nice
Summary
This package contains type definitions for json-stringify-nice (https://github.com/isaacs/json-stringify-nice).
Details
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/json-stringify-nice.
index.d.ts
export = jsonStringify;
/**
* Stringify an object sorting scalars before objects, and defaulting to 2-space indent.
*
* @example
* import stringify = require('json-stringify-nice');
* const obj = {
* z: 1,
* y: 'z',
* obj: { a: {}, b: 'x' },
* a: { b: 1, a: { nested: true} },
* yy: 'a',
* };
*
* console.log(stringify(obj));
*
* // output:
* // {
* // "y": "z", <-- alphabetical sorting like whoa!
* // "yy": "a",
* // "z": 1,
* // "a": { <-- a sorted before obj, because alphabetical, and both objects
* // "b": 1,
* // "a": { <-- note that a comes after b, because it's an object
* // "nested": true
* // }
* // },
* // "obj": {
* // "b": "x",
* // "a": {}
* // }
* // }
*/
declare function jsonStringify(
value: any,
replacer?: Array<number | string> | ((this: any, key: string, value: any) => any) | null,
space?: string | number,
): string;
Additional Details
- Last updated: Tue, 07 Nov 2023 03:09:37 GMT
- Dependencies: none
Credits
These definitions were written by BendingBender.