-
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: lists
// ft: test function (v, k, x)
const xlists = require('extra-lists');
var x = [['a', 'b', 'c', 'd'], [1, 2, 3, 2]];
xlists.search(x, v => v === 2);
// → 'b' ^
xlists.search(x, v => v === 4);
// → undefined