MCPcopy Create free account
hub / github.com/Effect-TS/effect / infiniteItems

Function infiniteItems

packages/effect/src/ui/Query.ts:1201–1217  ·  view source on GitHub ↗
(
  def: QueryDef,
  pages: ReadonlyArray<unknown>
)

Source from the content-addressed store, hash-verified

1199 * @internal
1200 */
1201export const infiniteItems = (
1202 def: QueryDef,
1203 pages: ReadonlyArray<unknown>
1204): ReadonlyArray<unknown> => {
1205 const list = def.list!
1206 const seen = new Set<string>()
1207 const out: Array<unknown> = []
1208 for (const page of pages) {
1209 for (const item of list.items(page)) {
1210 const key = list.key(item)
1211 if (seen.has(key)) continue
1212 seen.add(key)
1213 out.push(item)
1214 }
1215 }
1216 return out
1217}
1218
1219/**
1220 * A stream query class, as returned by `StreamService`.

Callers 1

itemsMethod · 0.85

Calls 5

itemsMethod · 0.65
keyMethod · 0.65
hasMethod · 0.65
addMethod · 0.65
pushMethod · 0.65

Tested by

no test coverage detected