1 | /**
|
2 | * Get a value from an object based on the given path
|
3 | *
|
4 | * Usage example:
|
5 | *
|
6 | * var obj = {
|
7 | * a : {
|
8 | * b : 123
|
9 | * }
|
10 | * };
|
11 | *
|
12 | * var result = getByPath(obj, ['a', 'b']); // 123
|
13 | *
|
14 | * You may also specify the path using an object with a path field
|
15 | *
|
16 | * var result = getByPath(obj, {path: ['a', 'b']}); // 123
|
17 | *
|
18 | * If the path doesn't exist undefined will be returned
|
19 | *
|
20 | * var result = getByPath(obj, ['x', 'y', 'z']); // undefined
|
21 | */
|
22 | declare function getByPath(root: any /*?Object | Error*/, path: string[], fallbackValue?: any): any;
|
23 |
|
24 | declare namespace getByPath {}
|
25 |
|
26 | export = getByPath;
|