FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

getPath · nodef/extra-array Wiki · GitHub

getPath

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

Get value at path in a nested array.

Alternatives: get, getAll, getPath.
Similar: hasPath, getPath, setPath$, removePath$.
Similar: get, set, remove.


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

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

xarray.getPath(x, [0, 1]);
// → 4

xarray.getPath(x, [0, 1, 2]);
// → undefined


References

Wiki pages Pages 196

Clone this wiki locally


Back | FazBrowse Home | New Git URL