Skip to content

hasEntry

Subhajit Sahu edited this page Dec 8, 2022 · 6 revisions

Check if object has an entry.

Similar: has, hasValue, hasEntry, hasSubset, hasPath.
Similar: entries, hasEntry, randomEntry.
Similar: keys, values, entries.


function hasEntry(x, e, fc, fm)
// x:  an object
// e:  search entry ([k, v])
// 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


References

Clone this wiki locally