Skip to content

findAll

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

Find values passing a test.

Alternatives: find, findAll.
Similar: find, search, searchValue.


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

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

[...ientries.findAll(x, v => v % 8 === 0)];
// → []


References

Clone this wiki locally