Skip to content
Subhajit Sahu edited this page Dec 28, 2022 · 15 revisions

Find first value passing a test (default order).

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


function find(x, ft)
// x:  ilists
// ft: test function (v, k, x)
const xilists = require('extra-ilists');

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

xilists.find(x, v => v % 8 === 0);
// → undefined


References

Clone this wiki locally