hasPath - nodef/extra-lists GitHub Wiki

Check if nested lists has a path.

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

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

var x = ['a', 'b', 'c'], [2, 4, 6](/nodef/extra-lists/wiki/'a',-'b',-'c'],-[2,-4,-6);
var y = ['x', 'e', 'f'], [x, 10, 12](/nodef/extra-lists/wiki/'x',-'e',-'f'],-[x,-10,-12);
xlists.hasPath(y, ['e']);
// → true

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

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

References