Skip to content

hasEntry

Subhajit Sahu edited this page Dec 22, 2022 · 11 revisions

Check if ientries has an entry.

Alternatives: has, hasValue, hasEntry, hasSubset, hasPath.
Similar: randomEntry, hasEntry.


function hasEntry(x, e, fc, fm)
// x:  ientries
// e:  search entry ([k, v])
// fc: compare function (a, b)
// fm: map function (v, k, x)
const ientries = require('extra-ientries');

var x = [["a", 1], ["b", 2], ["c", -3]];
ientries.hasEntry(x, ["c", 3]);
// → false

ientries.hasEntry(x, ["c", 3], (a, b) => Math.abs(a) - Math.abs(b));
// → true

ientries.hasEntry(x, ["c", 3], null, v => Math.abs(v));
// → true


References

Clone this wiki locally