lastIndicesWhere
lastIndicesWhere<
T>(iterable,predicate):IterableIterator<number>
Defined in: packages/core/src/iterable/indices-where.ts:46
Yields the zero-based index of every element satisfying predicate, scanning
from the end.
Indices are still counted from the start — only the order they are yielded in
is reversed, so the result is indicesWhere reversed.
An iterable has no end to start from, so a non-array source is materialised first and the whole of it is held in memory. An array is walked backwards in place.
Time complexity: O(n), with O(n) memory for a non-array source and O(1) for an array.
Type Parameters
Section titled “Type Parameters”T
Parameters
Section titled “Parameters”iterable
Section titled “iterable”Iterable<T>
The input iterable.
predicate
Section titled “predicate”Predicate<[T, number]>
Receives each element and its zero-based index.
Returns
Section titled “Returns”IterableIterator<number>
An iterator over the matching indices, descending.