hasEntry - nodef/extra-lists GitHub Wiki

Check if lists has an entry.

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

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

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

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

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

References