-
Notifications
You must be signed in to change notification settings - Fork 0
searchAll
Subhajit Sahu edited this page Jun 17, 2020
·
13 revisions
Finds keys of entries passing a test. 🏃 📼 📦 🌔 📒
Alternatives: search, searchAll.
Similar: search, searchValue.
entries.searchAll(x, fn);
// x: entries
// fn: test function (v, k, x)
const entries = require('extra-entries');
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' ] ^ ^