10 lines
202 B
TypeScript
Executable File
10 lines
202 B
TypeScript
Executable File
export async function asyncIterableToArray<T>(
|
|
iterator: AsyncIterable<T>
|
|
): Promise<T[]> {
|
|
const items: T[] = [];
|
|
for await (const item of iterator) {
|
|
items.push(item);
|
|
}
|
|
return items;
|
|
}
|