massive update, probably broken
[dotfiles/.git] / .config / coc / extensions / node_modules / coc-prettier / node_modules / flatted / types.d.ts
1 interface Flatted {
2   /**
3    * Converts a JavaScript Object Notation (using Flatted encoding) string into an object.
4    * @param text A valid Flatted string.
5    * @param reviver A function that transforms the results. This function is called for each member of the object.
6    * If a member contains nested objects, the nested objects are transformed before the parent object is.
7    */
8   parse(
9     text: string,
10     reviver?: (this: any, key: string, value: any) => any
11   ): any;
12   /**
13    * Converts a JavaScript value to a JavaScript Object Notation (using Flatted encoding) string.
14    * @param value A JavaScript value, usually an object or array, to be converted.
15    * @param replacer A function that transforms the results.
16    * @param space Adds indentation, white space, and line break characters to the return-value JSON text to make it easier to read.
17    */
18   stringify(
19     value: any,
20     replacer?: (this: any, key: string, value: any) => any,
21     space?: string | number
22   ): string;
23   /**
24    * Converts a JavaScript value to a JavaScript Object Notation (using Flatted encoding) string.
25    * @param value A JavaScript value, usually an object or array, to be converted.
26    * @param replacer An array of strings and numbers that acts as an approved list for selecting the object properties that will be stringified.
27    * @param space Adds indentation, white space, and line break characters to the return-value JSON text to make it easier to read.
28    */
29   stringify(
30     value: any,
31     replacer?: (number | string)[] | null,
32     space?: string | number
33   ): string;
34   /**
35    * Helper to allow explicit conversions with classes.
36    * @param value The JSON to convert to JavaScript value
37    */
38   fromJSON(value: any): any;
39   /**
40    * Helper to allow explicit conversions with classes.
41    * @param value A JavaScript value, usually an object or array, to be converted.
42    */
43   toJSON(value: any): any;
44 }
45
46 /**
47  * Fast and minimal circular JSON parser.
48  * logic example
49 ```js
50 var a = [{one: 1}, {two: '2'}];
51 a[0].a = a;
52 // a is the main object, will be at index '0'
53 // {one: 1} is the second object, index '1'
54 // {two: '2'} the third, in '2', and it has a string
55 // which will be found at index '3'
56 Flatted.stringify(a);
57 // [["1","2"],{"one":1,"a":"0"},{"two":"3"},"2"]
58 // a[one,two]    {one: 1, a}    {two: '2'}  '2'
59 ```
60  */
61 declare const Flatted: Flatted;
62 export = Flatted;