Skip to content

searchAll

Subhajit Sahu edited this page Jun 12, 2020 · 18 revisions

Finds keys of entries passing a test. 🏃 [:vhs:] 📦 🌔 📒

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

map.searchAll(x, fn, [ths]);
// x:   a map
// fn:  test function (v, k, x)
// ths: this argument
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

Clone this wiki locally