Skip to content

getPath

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

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

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

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