MCPcopy
hub / github.com/anomalyco/opencode / findLast

Function findLast

packages/core/src/util/array.ts:1–10  ·  view source on GitHub ↗
(
  items: readonly T[],
  predicate: (item: T, index: number, items: readonly T[]) => boolean,
)

Source from the content-addressed store, hash-verified

1export 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}

Callers 3

SessionContextTabFunction · 0.90
undoFunction · 0.90
redoFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected