fix(app): don't use findLast

This commit is contained in:
adamelmore 2026-01-24 12:36:42 -06:00
commit 1080f37f9c
No known key found for this signature in database
GPG key ID: 9CB48779AF150E75
6 changed files with 24 additions and 9 deletions

View file

@ -0,0 +1,10 @@
export function findLast<T>(
items: readonly T[],
predicate: (item: T, index: number, items: readonly T[]) => boolean,
): T | undefined {
for (let i = items.length - 1; i >= 0; i -= 1) {
const item = items[i]
if (predicate(item, i, items)) return item
}
return undefined
}