Giant blob of minor changes
[dotfiles/.git] / .config / coc / extensions / node_modules / coc-prettier / node_modules / dot-prop / index.d.ts
1 declare const dotProp: {
2         /**
3         @param object - Object to get the `path` value.
4         @param path - Path of the property in the object, using `.` to separate each nested key. Use `\\.` if you have a `.` in the key.
5         @param defaultValue - Default value.
6
7         @example
8         ```
9         import dotProp = require('dot-prop');
10
11         dotProp.get({foo: {bar: 'unicorn'}}, 'foo.bar');
12         //=> 'unicorn'
13
14         dotProp.get({foo: {bar: 'a'}}, 'foo.notDefined.deep');
15         //=> undefined
16
17         dotProp.get({foo: {bar: 'a'}}, 'foo.notDefined.deep', 'default value');
18         //=> 'default value'
19
20         dotProp.get({foo: {'dot.dot': 'unicorn'}}, 'foo.dot\\.dot');
21         //=> 'unicorn'
22         ```
23         */
24         get<T>(
25                 object: {[key: string]: any} | undefined,
26                 path: string
27         ): T | undefined;
28         get<T>(
29                 object: {[key: string]: any} | undefined,
30                 path: string,
31                 defaultValue: T
32         ): T;
33
34         /**
35         @param object - Object to set the `path` value.
36         @param path - Path of the property in the object, using `.` to separate each nested key. Use `\\.` if you have a `.` in the key.
37         @param value - Value to set at `path`.
38         @returns The object.
39
40         @example
41         ```
42         import dotProp = require('dot-prop');
43
44         const object = {foo: {bar: 'a'}};
45         dotProp.set(object, 'foo.bar', 'b');
46         console.log(object);
47         //=> {foo: {bar: 'b'}}
48
49         const foo = dotProp.set({}, 'foo.bar', 'c');
50         console.log(foo);
51         //=> {foo: {bar: 'c'}}
52
53         dotProp.set(object, 'foo.baz', 'x');
54         console.log(object);
55         //=> {foo: {bar: 'b', baz: 'x'}}
56         ```
57         */
58         set<T extends {[key: string]: any}>(
59                 object: T,
60                 path: string,
61                 value: unknown
62         ): T;
63
64         /**
65         @param object - Object to test the `path` value.
66         @param path - Path of the property in the object, using `.` to separate each nested key. Use `\\.` if you have a `.` in the key.
67
68         @example
69         ```
70         import dotProp = require('dot-prop');
71
72         dotProp.has({foo: {bar: 'unicorn'}}, 'foo.bar');
73         //=> true
74         ```
75         */
76         has(object: {[key: string]: any} | undefined, path: string): boolean;
77
78         /**
79         @param object - Object to delete the `path` value.
80         @param path - Path of the property in the object, using `.` to separate each nested key. Use `\\.` if you have a `.` in the key.
81         @returns A boolean of whether the property existed before being deleted.
82
83         @example
84         ```
85         import dotProp = require('dot-prop');
86
87         const object = {foo: {bar: 'a'}};
88         dotProp.delete(object, 'foo.bar');
89         console.log(object);
90         //=> {foo: {}}
91
92         object.foo.bar = {x: 'y', y: 'x'};
93         dotProp.delete(object, 'foo.bar.x');
94         console.log(object);
95         //=> {foo: {bar: {y: 'x'}}}
96         ```
97         */
98         delete(object: {[key: string]: any}, path: string): boolean;
99 };
100
101 export = dotProp;