|
| 1 | +export interface JSStringifySetterOptions<ObjType, RootType> { |
| 2 | + currentKey: string; |
| 3 | + currentPath: string; |
| 4 | + value: any; |
| 5 | + obj: ObjType; |
| 6 | + root: RootType; |
| 7 | + defaultValuesMap: { |
| 8 | + [path: string]: any; |
| 9 | + }; |
| 10 | +} |
| 11 | +export interface JSStringifyPropertyReplacerOptions<ObjType, RootType> { |
| 12 | + currentKey: string; |
| 13 | + currentPath: string; |
| 14 | + propertyRenameMap: { |
| 15 | + [pattern: string]: string; |
| 16 | + }; |
| 17 | + obj: ObjType; |
| 18 | + root: RootType; |
| 19 | + value?: any; |
| 20 | +} |
| 21 | +export type JSStringifySetter = (options: JSStringifySetterOptions<any, any>) => any; |
| 22 | +export type JSStringifyReplacer = (options: JSStringifyPropertyReplacerOptions<any, any>) => any; |
1 | 23 | export interface JSStringifyOptions { |
2 | 24 | space?: number; |
3 | | - replacer?: (key: string, value: any) => any | null; |
4 | | - propertyReplacer?: (currentKey: string, currentPath: string, propertyRenameMap: { |
5 | | - [pattern: string]: string; |
6 | | - }) => string; |
| 25 | + propertyReplacer?: (options: JSStringifyPropertyReplacerOptions<any, any>) => string; |
| 26 | + valueReplacer?: Record<string, (options: JSStringifyPropertyReplacerOptions<any, any>) => any>; |
7 | 27 | quotes?: 'single' | 'double' | 'backtick'; |
8 | 28 | inlineArrayLimit?: number; |
9 | 29 | camelCase?: boolean; |
10 | 30 | camelCaseFn?: (str: string) => string; |
11 | | - propertyRenameMap?: { |
12 | | - [key: string]: string; |
13 | | - }; |
| 31 | + include?: string[]; |
| 32 | + exclude?: string[]; |
14 | 33 | defaultValuesMap?: { |
15 | 34 | [path: string]: any; |
16 | 35 | }; |
17 | | - defaultValuesSetter?: { |
18 | | - [path: string]: (currentKey: string, currentPath: string, value: any, obj?: any) => any; |
| 36 | + propertyRenameMap?: { |
| 37 | + [path: string]: any; |
19 | 38 | }; |
| 39 | + defaultValuesSetter?: { |
| 40 | + [path: string]: JSStringifySetter; |
| 41 | + } | JSStringifySetter; |
20 | 42 | json?: boolean; |
21 | 43 | } |
22 | 44 | export declare function chooseQuotes(str: string, preferred: 'single' | 'double' | 'backtick'): string; |
|
0 commit comments