Finds indices of values passing a test.
npm install @extra-array/search-allFinds indices of values passing a test.
:package:
:smiley_cat:
:running:
:vhs:
:moon:
:scroll:
:newspaper:
:blue_book:
> Alternatives: [search], [searchRight], [searchAll].
> Similar: [search], [scan], [find].
> This is part of package [extra-array].
[extra-array]: https://www.npmjs.com/package/extra-array
``javascript`
array.searchAll(x, ft);
// x: an array
// ft: test function (v, i, x)
`javascript
const array = require("extra-array");
var x = [1, 2, 3, 2, 5];
array.searchAll(x, 2);
// [ 1, 3 ] ^ ^
var x = [1, 2, 3, -2, 5];
array.searchAll(x, 2, (a, b) => Math.abs(a) - Math.abs(b));
// [ 1, 3 ] ^ ^
array.searchAll(x, 2, null, v => Math.abs(v));
// [ 1, 3 ] ^ ^
``
- List-Extra.elemIndices: elm
- iterable-binsearch: @krisselden
- binarysearch: @soldair
[search]: https://github.com/nodef/extra-array/wiki/search
[searchRight]: https://github.com/nodef/extra-array/wiki/searchRight
[searchAll]: https://github.com/nodef/extra-array/wiki/searchAll
[scan]: https://github.com/nodef/extra-array/wiki/scan
[find]: https://github.com/nodef/extra-array/wiki/find