Skip to content

getPath

Subhajit Sahu edited this page Dec 22, 2022 · 7 revisions

Get value at path in nested entries.

Alternatives: get, getAll, getPath, hasPath.
Similar: get, set, remove.


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

var x = [["a", 2], ["b", 4], ["c", 6]];
var y = [["x", x], ["e", 10], ["f", 12]];
entries.getPath(y, ["e"]);
// → 10

entries.getPath(y, ["x", "b"]);
// → 4

entries.getPath(y, ["x", "b", "c"]);
// → undefined


References

Clone this wiki locally