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 5f58109 commit ae07db4Copy full SHA for ae07db4
src/lib/seed/utils.ts
@@ -11,11 +11,5 @@ export const isPromiseLike = (o: any): boolean => !!o && (typeof o === 'object'
11
/**
12
* Times repeats a function n times
13
*/
14
-export const times = async <TResult>(n: number, iteratee: (index: number) => Promise<TResult>): Promise<TResult[]> => {
15
- const rs = [] as TResult[];
16
- for (let i = 0; i < n; i++) {
17
- const r = await iteratee(i);
18
- rs.push(r);
19
- }
20
- return rs;
21
-};
+export const times = async <TResult>(n: number, iteratee: (index: number) => Promise<TResult>): Promise<TResult[]> =>
+ Promise.all(new Array(n).map(async (v, i) => await iteratee(i)));
0 commit comments