mirror of
https://github.com/anomalyco/opencode.git
synced 2026-04-28 12:39:43 +00:00
refactor: rename shared package to core (#24309)
This commit is contained in:
parent
37aa8442dc
commit
62ef2a2207
166 changed files with 218 additions and 218 deletions
10
packages/core/src/util/array.ts
Normal file
10
packages/core/src/util/array.ts
Normal 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
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue