WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
Skip to content

hasPath

Subhajit Sahu edited this page May 3, 2023 · 9 revisions

Check if nested array has a path.

Alternatives: hasValue, hasPrefix, hasSuffix, hasInfix, hasSubsequence, hasPermutation, hasPath.
Similar: hasPath, getPath, setPath$, removePath$.


function hasPath(x, p)
// x: a nested array
// p: path
const xarray = require('extra-array');

var x = [[2, 4], 6, 8];
xarray.hasPath(x, [1]);
// → true

xarray.hasPath(x, [0, 1]);
// → true

xarray.hasPath(x, [0, 1, 2]);
// → false


References

Clone this wiki locally