@extra-array/search-all
TypeScript icon, indicating that this package has built-in type declarations

2.9.45 • Public • Published

Finds indices of values passing a test. 🏃 📼 📦 🌔 📒

Alternatives: search, searchRight, searchAll.
This is part of package extra-array.

array.searchAll(x, ft);
// x:  an array
// ft: test function (v, i, x)
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 ] ^      ^

references

Package Sidebar

Install

npm i @extra-array/search-all@2.9.45

Version

2.9.45

License

MIT

Unpacked Size

6.75 kB

Total Files

14

Last publish

Collaborators

  • wolfram77