2.2.5 • Published 5 years ago
@extra-object/get-path.min v2.2.5
Gets value at path in a nested object. :running: :package: :ledger:
Alternatives: get, getAll, getPath. Similar: hasPath, getPath, setPath$, removePath$. Similar: get, set, remove. This is part of package extra-object.
This is browserified, minified version of @extra-object/get-path. It is exported as global variable object_getPath. CDN: unpkg, jsDelivr.
object.getPath(x, p);
// x: a nested object
// p: path
const object = require('extra-object');
var x = {a: {b: 2, c: 3}, d: 4};
object.getPath(x, ['d']);
// 4
object.getPath(x, ['a', 'b']);
// 2
object.getPath(x, ['a', 'b', 'c']);
// undefined