npm.io
2.10.19 • Published 4 years ago

@extra-array/get-path

Licence
MIT
Version
2.10.19
Deps
0
Size
4 kB
Vulns
0
Weekly
0
Stars
17

Gets value at path in a nested array.

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

This is part of package extra-array.


array.getPath(x, p);
// x: a nested array
// p: path
const array = require("extra-array");

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

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

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


References

Keywords