9
common/resources/client/utils/array/async-iterable-to-array.ts
Executable file
9
common/resources/client/utils/array/async-iterable-to-array.ts
Executable file
@@ -0,0 +1,9 @@
|
||||
export async function asyncIterableToArray<T>(
|
||||
iterator: AsyncIterable<T>
|
||||
): Promise<T[]> {
|
||||
const items: T[] = [];
|
||||
for await (const item of iterator) {
|
||||
items.push(item);
|
||||
}
|
||||
return items;
|
||||
}
|
||||
Reference in New Issue
Block a user