1 declare const dotProp: {
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.
9 import dotProp = require('dot-prop');
11 dotProp.get({foo: {bar: 'unicorn'}}, 'foo.bar');
14 dotProp.get({foo: {bar: 'a'}}, 'foo.notDefined.deep');
17 dotProp.get({foo: {bar: 'a'}}, 'foo.notDefined.deep', 'default value');
20 dotProp.get({foo: {'dot.dot': 'unicorn'}}, 'foo.dot\\.dot');
25 object: {[key: string]: any} | undefined,
29 object: {[key: string]: any} | undefined,
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`.
41 import dotProp = require('dot-prop');
43 const object = {foo: {bar: 'a'}};
44 dotProp.set(object, 'foo.bar', 'b');
46 //=> {foo: {bar: 'b'}}
48 const foo = dotProp.set({}, 'foo.bar', 'c');
50 //=> {foo: {bar: 'c'}}
52 dotProp.set(object, 'foo.baz', 'x');
54 //=> {foo: {bar: 'b', baz: 'x'}}
57 set<T extends {[key: string]: any}>(
64 @param object - Object to test the `path` value.
65 @param path - Path of the property in the object, using `.` to separate each nested key. Use `\\.` if you have a `.` in the key.
69 import dotProp = require('dot-prop');
71 dotProp.has({foo: {bar: 'unicorn'}}, 'foo.bar');
75 has(object: {[key: string]: any} | undefined, path: string): boolean;
78 @param object - Object to delete the `path` value.
79 @param path - Path of the property in the object, using `.` to separate each nested key. Use `\\.` if you have a `.` in the key.
83 import dotProp = require('dot-prop');
85 const object = {foo: {bar: 'a'}};
86 dotProp.delete(object, 'foo.bar');
90 object.foo.bar = {x: 'y', y: 'x'};
91 dotProp.delete(object, 'foo.bar.x');
93 //=> {foo: {bar: {y: 'x'}}}
96 delete(object: {[key: string]: any}, path: string): void;