2.2.5 • Published 3 years ago
@extra-object/has-path v2.2.5
Checks if nested object has a path. :running: :package: :ledger:
Alternatives: has, hasValue, hasEntry, hasSubset, hasPath. Similar: hasPath, getPath, setPath$, removePath$. This is part of package extra-object.
object.hasPath(x, p);
// x: a nested object
// p: path
const object = require('extra-object');
var x = {a: {b: 2, c: 3}, d: 4};
object.hasPath(x, ['d']);
// true
object.hasPath(x, ['a', 'b']);
// true
object.hasPath(x, ['a', 'b', 'c']);
// false