-
Notifications
You must be signed in to change notification settings - Fork 0
getPath
Subhajit Sahu edited this page Jun 28, 2020
·
8 revisions
Gets value at path in nested lists. 🏃 📼 📦 🌔 📒
Alternatives: get, [getAll], [getPath].
Similar: [hasPath], [getPath].
Similar: get, set, remove.
lists.getPath(x, p);
// x: nested lists
// p: path
const lists = require('extra-lists');
var x = [['a', 'b', 'c'], [2, 4, 6]];
var y = [['x', 'e', 'f'], [x, 10, 12]];
lists.getPath(y, ['e']);
// 10
lists.getPath(y, ['x', 'b']);
// 4
lists.getPath(y, ['x', 'b', 'c']);
// undefined