Skip to content

hasPath

Subhajit Sahu edited this page Jun 28, 2020 · 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