hasEntry - nodef/extra-map GitHub Wiki

Check if map has an entry.

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

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

var x = new Map(['a', 1], ['b', 2], ['c', -3](/nodef/extra-map/wiki/'a',-1],-['b',-2],-['c',--3));
map.hasEntry(x, ['c', 3]);
// → false

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

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

References