Finds index of last value passing a test.
:package:
:smileycat:
:running:
:vhs:
:moon:
:scroll:
:newspaper:
:bluebook:
Alternatives: search, searchRight, searchAll.
Similar: search, scan, find.
This is part of package extra-iterable.
This is browserified, minified version of @extra-iterable/search-right.
It is exported as global variable iterablesearchRight.
CDN: unpkg, jsDelivr.
iterable.searchRight(x, ft);
// x: an iterable
// ft: test function (v, i, x)
// → index of value, -1 if not found
const iterable = require("extra-iterable");
var x = [1, 2, 3, 4, 5];
iterable.searchRight(x, v => v % 2 == 0);
// 3 ^
iterable.searchRight(x, v => v % 2 == 1);
// 4 ^