MCPcopy Create free account
hub / github.com/freecodexyz/free-code / toArray

Function toArray

src/utils/generators.ts:74–82  ·  view source on GitHub ↗
(
  generator: AsyncGenerator<A, void>,
)

Source from the content-addressed store, hash-verified

72}
73
74export async function toArray<A>(
75 generator: AsyncGenerator<A, void>,
76): Promise<A[]> {
77 const result: A[] = []
78 for await (const a of generator) {
79 result.push(a)
80 }
81 return result
82}
83
84export async function* fromArray<T>(values: T[]): AsyncGenerator<T, void> {
85 for (const value of values) {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected