Skip to content

getPath

Subhajit Sahu edited this page Feb 4, 2021 · 7 revisions

Gets value at path in nested entries. 📦 😺 🏃 📼 🌔 📜 📰 📘

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


entries.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