( items: readonly T[], predicate: (item: T, index: number, items: readonly T[]) => boolean, )
| 1 | export function findLast<T>( |
| 2 | items: readonly T[], |
| 3 | predicate: (item: T, index: number, items: readonly T[]) => boolean, |
| 4 | ): T | undefined { |
| 5 | for (let i = items.length - 1; i >= 0; i -= 1) { |
| 6 | const item = items[i] |
| 7 | if (predicate(item, i, items)) return item |
| 8 | } |
| 9 | return undefined |
| 10 | } |
no outgoing calls
no test coverage detected