Download packages/core/src/util/array.ts from SaylorTwift/opencode: direct link, hf CLI and curl.
- Browser
- Download file 291 Bytes
-
https://huggingface.co/SaylorTwift/opencode/resolve/main/packages/core/src/util/array.ts
- Command line
-
hf download hf://SaylorTwift/opencode/packages/core/src/util/array.ts
-
curl -L -o array.ts https://huggingface.co/SaylorTwift/opencode/resolve/main/packages/core/src/util/array.ts
291 Bytes
| 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 | |
| } | |