Function
findLast
(
array: ReadonlyArray<T>,
predicate: (item: T) => boolean,
)
Source from the content-addressed store, hash-verified
| 505 | } |
| 506 | |
| 507 | export function findLast<T>( |
| 508 | array: ReadonlyArray<T>, |
| 509 | predicate: (item: T) => boolean, |
| 510 | ): T | undefined { |
| 511 | for (let i = array.length - 1; i >= 0; i--) { |
| 512 | const item = array[i]! |
| 513 | if (predicate(item)) return item |
| 514 | } |
| 515 | return undefined |
| 516 | } |
| 517 | |
| 518 | /** |
| 519 | * Remove control characters that can cause open redirect vulnerabilities. |
Tested by
no test coverage detected