Skip to content

hasPath

Subhajit Sahu edited this page Feb 4, 2021 · 8 revisions

Checks if nested lists has a path. 🏃 📼 📦 🌔 📒

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

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

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

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

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

references

Clone this wiki locally