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

2.10.19 • Public • Published

Finds index of last value passing a test. 📦 😺 🏃 📼 🌔 📜 📰 📘

Alternatives: search, searchRight, searchAll.
Similar: search, scan, find.

This is part of package extra-array.


array.searchRight(x, ft);
// x:  an array
// ft: test function (v, i, x)
// → index of value, -1 if not found
const array = require("extra-array");

var x = [1, 2, 3, 2, 5];
array.searchRight(x, 2);
// 3              ^

var x = [1, 2, 3, -2, 5];
array.searchRight(x, 2, (a, b) => Math.abs(a) - Math.abs(b));
// 3               ^

array.searchRight(x, 2, null, v => Math.abs(v));
// 3               ^


References

Package Sidebar

Install

npm i @extra-array/search-right

Weekly Downloads

3

Version

2.10.19

License

MIT

Unpacked Size

4.62 kB

Total Files

8

Last publish

Collaborators

  • wolfram77