2.2.5 • Published 3 years ago

@extra-object/get-path v2.2.5

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago

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.

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

references

2.2.5

3 years ago

2.2.4

4 years ago

2.2.3

4 years ago

2.2.2

4 years ago