-
Notifications
You must be signed in to change notification settings - Fork 3
hasPath
Subhajit Sahu edited this page Jun 28, 2020
·
3 revisions
Checks if nested object has a path. 🏃 📼 📦 🌔 📒
Alternatives: has, hasValue, hasEntry, hasSubset, hasPath.
Similar: hasPath, getPath, setPath$, removePath$.
object.hasPath(x, p);
// x: a nested object
// p: pathconst 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