2.2.5 • Published 3 years ago
@extra-object/has-entry v2.2.5
Checks if object has an entry. :running: :package: :ledger:
Alternatives: has, hasValue, hasEntry, hasSubset, hasPath. Similar: entry, entries, hasEntry. This is part of package extra-object.
object.hasEntry(x, e, [fc], [fm]);
// x: an object
// e: entry?
// fc: compare function (a, b)
// fm: map function (v, k, x)
const object = require('extra-object');
var x = {a: 1, b: 2, c: -3};
object.hasEntry(x, ['c', 3]);
// false
object.hasEntry(x, ['c', 3], (a, b) => Math.abs(a) - Math.abs(b));
// true
object.hasEntry(x, ['c', 3], null, v => Math.abs(v));
// true