We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
Find indices of values passing a test.
Alternatives: search, searchRight, searchAll. Similar: search, scan, find.
function searchAll(x, ft) // x: an array // ft: test function (v, i, x)
const xarray = require('extra-array'); var x = [1, 2, 3, 2, 5]; xarray.searchAll(x, 2); // → [ 1, 3 ] ^ ^ var x = [1, 2, 3, -2, 5]; xarray.searchAll(x, 2, (a, b) => Math.abs(a) - Math.abs(b)); // → [ 1, 3 ] ^ ^ xarray.searchAll(x, 2, null, v => Math.abs(v)); // → [ 1, 3 ] ^ ^