@extra-map/search-all.min

Finds keys of entries passing a test. :package: :smiley_cat: :running: :vhs: :moon: :scroll: :newspaper: :blue_book:

Usage no npm install needed!

<script type="module">
  import extraMapSearchAllMin from 'https://cdn.skypack.dev/@extra-map/search-all.min';
</script>

README

Finds keys of entries passing a test. :package: :smiley_cat: :running: :vhs: :moon: :scroll: :newspaper: :blue_book:

Alternatives: search, searchAll.
Similar: search, searchValue.

This is part of package extra-map.

This is browserified, minified version of @extra-map/search-all.
It is exported as global variable map_searchAll.
CDN: unpkg, jsDelivr.


map.searchAll(x, ft);
// x:  a map
// ft: test function (v, k, x)
const map = require("extra-map");

var x = new Map([["a", 1], ["b", 2], ["c", 3], ["d", -2]]);
map.searchAll(x, v => v === 2);
// [ "b" ]                   ^

map.searchAll(x, v => Math.abs(v) === 2);
// [ "b", "d" ]              ^                   ^


References