Skip to content

getPath

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

Get value at path in nested ientries.

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


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

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

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

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


References

Clone this wiki locally