Skip to content

hasPath

Subhajit Sahu edited this page Dec 22, 2022 · 7 revisions

Check if nested entries has a path.

Alternatives: has, hasValue, hasEntry, hasSubset, hasPath.
Similar: hasPath, getPath.


function hasPath(x, p)
// x: nested entries
// p: search path
const entries = require('extra-entries');

var x = [["a", 2], ["b", 4], ["c", 6]];
var y = [["x", x], ["e", 10], ["f", 12]];
entries.hasPath(y, ["e"]);
// → true

entries.hasPath(y, ["x", "b"]);
// → true

entries.hasPath(y, ["x", "b", "c"]);
// → false


References

Clone this wiki locally