-
Notifications
You must be signed in to change notification settings - Fork 3
getPath
Subhajit Sahu edited this page Jun 28, 2020
·
3 revisions
Gets value at key. [:running:] [:vhs:] [:package:] [:moon:] [:ledger:]
Alternatives: [get], [getAll], [getPath].
Similar: [hasPath], [getPath], [setPath$], [removePath$].
Similar: [get], [set], [remove].
object.get(x, k);
// x: an object
// k: keyconst object = require('extra-object');
var x = {a: {b: 2, c: 3}, d: 4};
object.getPath(x, ['d']);
// 4
object.getPath(x, ['a', 'b']);
// 2
object.getPath(x, ['a', 'b', 'c']);
// undefined