Skip to content

searchAll

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

Finds keys of entries passing a test. 🏃 📼 📦 🌔 📒

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

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

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

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

references

Clone this wiki locally