-
Notifications
You must be signed in to change notification settings - Fork 1
find
Subhajit Sahu edited this page Dec 2, 2022
·
17 revisions
Find first value passing a test (default order).
Alternatives: find, findAll.
Similar: find, search, searchValue.
function find(x, ft)
// x: a set
// ft: test function (v, v, x)
const set = require('extra-set');
var x = new Set([1, 2, 3, 4]);
set.find(x, v => v % 2 === 0);
// → 2 ^
set.find(x, v => v % 8 === 0);
// → undefined