Skip to content

hasPath

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

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

Alternatives: [has], [hasValue], [hasEntry], [hasSubset], [hasPath].
Similar: [hasPath], [getPath], [setPath$], [removePath$].

object.get(x, k);
// x: an object
// k: key
const object = require('extra-object');

var x = {a: {b: 2, c: 3}, d: 4};
object.hasPath(x, ['d']);
// true

object.hasPath(x, ['a', 'b']);
// true

object.hasPath(x, ['a', 'b', 'c']);
// false

references

Clone this wiki locally