Skip to content

hasEntry

Subhajit Sahu edited this page Feb 4, 2021 · 10 revisions

Checks if map has an entry. 🏃 📼 📦 🌔 📒

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


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

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

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

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


References

Clone this wiki locally