2.2.5 • Published 3 years ago
@extra-object/has-path.min 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.
This is browserified, minified version of @extra-object/has-path. It is exported as global variable object_hasPath. CDN: unpkg, jsDelivr.
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