We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 6b9209d commit a9d0b4dCopy full SHA for a9d0b4d
index.ts
@@ -64,3 +64,14 @@ function fromPromiseOfIteratorLike<T>(iterator: PromiseOfAsyncIteratorLike<T>):
64
};
65
return {next: async () => next()};
66
}
67
+
68
+export async function asyncToArrayOnce<T>(iterator: AsyncIteratorLike<T>): Promise<T[]> {
69
+ const it = asyncIterator(iterator);
70
+ const array: T[] = [];
71
+ let element = await it.next();
72
+ while (element.done !== true) {
73
+ array.push(element.value);
74
+ element = await it.next();
75
+ }
76
+ return array;
77
+}
0 commit comments