Skip to content

searchAll

Subhajit Sahu edited this page Dec 22, 2022 · 13 revisions

Find keys of ientries passing a test.

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


function searchAll(x, ft)
// x:  ientries
// ft: test function (v, k, x)
const ientries = require('extra-ientries');

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

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


References

Clone this wiki locally