source: imaps-frontend/node_modules/json5/lib/stringify.d.ts@ d565449

main
Last change on this file since d565449 was d565449, checked in by stefan toskovski <stefantoska84@…>, 4 weeks ago

Update repo after prototype presentation

  • Property mode set to 100644
File size: 4.1 KB
Line 
1declare type StringifyOptions = {
2 /**
3 * A function that alters the behavior of the stringification process, or an
4 * array of String and Number objects that serve as a allowlist for
5 * selecting/filtering the properties of the value object to be included in
6 * the JSON5 string. If this value is null or not provided, all properties
7 * of the object are included in the resulting JSON5 string.
8 */
9 replacer?:
10 | ((this: any, key: string, value: any) => any)
11 | (string | number)[]
12 | null
13
14 /**
15 * A String or Number object that's used to insert white space into the
16 * output JSON5 string for readability purposes. If this is a Number, it
17 * indicates the number of space characters to use as white space; this
18 * number is capped at 10 (if it is greater, the value is just 10). Values
19 * less than 1 indicate that no space should be used. If this is a String,
20 * the string (or the first 10 characters of the string, if it's longer than
21 * that) is used as white space. If this parameter is not provided (or is
22 * null), no white space is used. If white space is used, trailing commas
23 * will be used in objects and arrays.
24 */
25 space?: string | number | null
26
27 /**
28 * A String representing the quote character to use when serializing
29 * strings.
30 */
31 quote?: string | null
32}
33
34/**
35 * Converts a JavaScript value to a JSON5 string.
36 * @param value The value to convert to a JSON5 string.
37 * @param replacer A function that alters the behavior of the stringification
38 * process. If this value is null or not provided, all properties of the object
39 * are included in the resulting JSON5 string.
40 * @param space A String or Number object that's used to insert white space into
41 * the output JSON5 string for readability purposes. If this is a Number, it
42 * indicates the number of space characters to use as white space; this number
43 * is capped at 10 (if it is greater, the value is just 10). Values less than 1
44 * indicate that no space should be used. If this is a String, the string (or
45 * the first 10 characters of the string, if it's longer than that) is used as
46 * white space. If this parameter is not provided (or is null), no white space
47 * is used. If white space is used, trailing commas will be used in objects and
48 * arrays.
49 * @returns The JSON5 string converted from the JavaScript value.
50 */
51declare function stringify(
52 value: any,
53 replacer?: ((this: any, key: string, value: any) => any) | null,
54 space?: string | number | null,
55): string
56
57/**
58 * Converts a JavaScript value to a JSON5 string.
59 * @param value The value to convert to a JSON5 string.
60 * @param replacer An array of String and Number objects that serve as a
61 * allowlist for selecting/filtering the properties of the value object to be
62 * included in the JSON5 string. If this value is null or not provided, all
63 * properties of the object are included in the resulting JSON5 string.
64 * @param space A String or Number object that's used to insert white space into
65 * the output JSON5 string for readability purposes. If this is a Number, it
66 * indicates the number of space characters to use as white space; this number
67 * is capped at 10 (if it is greater, the value is just 10). Values less than 1
68 * indicate that no space should be used. If this is a String, the string (or
69 * the first 10 characters of the string, if it's longer than that) is used as
70 * white space. If this parameter is not provided (or is null), no white space
71 * is used. If white space is used, trailing commas will be used in objects and
72 * arrays.
73 * @returns The JSON5 string converted from the JavaScript value.
74 */
75declare function stringify(
76 value: any,
77 replacer: (string | number)[],
78 space?: string | number | null,
79): string
80
81/**
82 * Converts a JavaScript value to a JSON5 string.
83 * @param value The value to convert to a JSON5 string.
84 * @param options An object specifying options.
85 * @returns The JSON5 string converted from the JavaScript value.
86 */
87declare function stringify(value: any, options: StringifyOptions): string
88
89export = stringify
Note: See TracBrowser for help on using the repository browser.