Skip to content

getPath

Subhajit Sahu edited this page Jun 28, 2020 · 8 revisions

Gets value at key. [:running:] [:vhs:] [:package:] [:moon:] [:ledger:]

Similar: [get], [set], [remove].

lists.get(x, k);
// x: lists
// k: key
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

references

Clone this wiki locally