@extra-lists/has-entry.min

Checks if map has an entry. :package: :smiley_cat: :running: :vhs: :moon: :scroll: :newspaper: :blue_book:

Usage no npm install needed!

<script type="module">
  import extraListsHasEntryMin from 'https://cdn.skypack.dev/@extra-lists/has-entry.min';
</script>

README

Checks if map has an entry. :package: :smiley_cat: :running: :vhs: :moon: :scroll: :newspaper: :blue_book:

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

This is part of package extra-lists.

This is browserified, minified version of @extra-lists/has-entry.
It is exported as global variable lists_hasEntry.
CDN: unpkg, jsDelivr.


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