-
Notifications
You must be signed in to change notification settings - Fork 0
search
Subhajit Sahu edited this page Dec 28, 2022
·
14 revisions
Finds key of an entry passing a test.
Alternatives: search, searchAll.
Similar: find, search, searchValue.
function search(x, ft)
// x: ilists
// ft: test function (v, k, x)
const xilists = require('extra-ilists');
var x = [['a', 'b', 'c', 'd'], [1, 2, 3, 2]];
xilists.search(x, v => v === 2);
// → 'b' ^
xilists.search(x, v => v === 4);
// → undefined