UNPKG

730 BTypeScriptView Raw
1// Type definitions for json-stable-stringify 1.0
2// Project: https://github.com/substack/json-stable-stringify
3// Definitions by: Matt Frantz <https://github.com/mhfrantz>
4// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
5
6declare function stringify(obj: any, opts?: stringify.Comparator | stringify.Options): string;
7
8declare namespace stringify {
9 interface Element {
10 key: string;
11 value: any;
12 }
13
14 type Comparator = (a: Element, b: Element) => number;
15
16 type Replacer = (key: string, value: any) => any;
17
18 interface Options {
19 cmp?: Comparator | undefined;
20 space?: number | string | undefined;
21 replacer?: Replacer | undefined;
22 }
23}
24
25export = stringify;