Skip to content

hasPath

Subhajit Sahu edited this page Dec 28, 2022 · 8 revisions

Check if nested ilists has a path.

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


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

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

xilists.hasPath(y, ['x', 'b']);
// → true

xilists.hasPath(y, ['x', 'b', 'c']);
// → false


References

Clone this wiki locally