Skip to content

Latest commit

 

History

History
55 lines (45 loc) · 1.92 KB

get.md

File metadata and controls

55 lines (45 loc) · 1.92 KB

Object Agent

A javascript library for working with objects

npm build coverage deps size vulnerabilities license


get(object, path) ⇒ unknown

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'