A javascript library for working with objects
Gets a nested value from an object.
Returns: unknown
- The value at the end of the path or undefined.
Param | Type | Description |
---|---|---|
object | object |
The object to traverse. |
path | string |
Dot delimited string. |
Example
import { get } from 'object-agent';
const thing = {
a: [{
b: 'c'
}, {
b: 'd'
}]
};
get(thing, 'a.1.b');
// => 'd'