searchAll - nodef/extra-lists GitHub Wiki
Find keys of entries passing a test.
Alternatives: search, searchAll. Similar: search, searchValue.
function searchAll(x, ft)
// x: lists
// ft: test function (v, k, x)
const xlists = require('extra-lists');
var x = ['a', 'b', 'c', 'd'], [1, 2, 3, -2](/nodef/extra-lists/wiki/'a',-'b',-'c',-'d'],-[1,-2,-3,--2);
[...xlists.searchAll(x, v => v === 2)];
// → [ 'b' ] ^
[...xlists.searchAll(x, v => Math.abs(v) === 2)];
// → [ 'b', 'd' ] ^ ^