MCPcopy Create free account
hub / github.com/Zoo-Code-Org/Zoo-Code / findLastIndex

Function findLastIndex

src/shared/array.ts:9–17  ·  view source on GitHub ↗
(array: Array<T>, predicate: (value: T, index: number, obj: T[]) => boolean)

Source from the content-addressed store, hash-verified

7 * findLastIndex immediately returns that element index. Otherwise, findLastIndex returns -1.
8 */
9export function findLastIndex<T>(array: Array<T>, predicate: (value: T, index: number, obj: T[]) => boolean): number {
10 let l = array.length
11 while (l--) {
12 if (predicate(array[l], l, array)) {
13 return l
14 }
15 }
16 return -1
17}
18
19export function findLast<T>(array: Array<T>, predicate: (value: T, index: number, obj: T[]) => boolean): T | undefined {
20 const index = findLastIndex(array, predicate)

Callers 7

resumeTaskFromHistoryMethod · 0.90
taskMetadataFunction · 0.90
findLastFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected