Skip to content

hasEntry

Subhajit Sahu edited this page Dec 28, 2022 · 10 revisions

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]];
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

Clone this wiki locally