Skip to content

findAll

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

Finds values passing a test. 🏃 📼 📦 🌔 📒

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


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

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

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


References

Clone this wiki locally