functional: init
This commit is contained in:
8
src/functional.ts
Normal file
8
src/functional.ts
Normal file
@@ -0,0 +1,8 @@
|
||||
export const sequence = <T, U>(fn: ($: T) => Promise<U>) => async (L: T[]) => {
|
||||
for (const o of L)
|
||||
await fn(o);
|
||||
};
|
||||
|
||||
export const parallel = <T, U>(fn: ($: T) => Promise<U>) => async (L: T[]) => {
|
||||
await Promise.all(L.map(fn));
|
||||
};
|
||||
Reference in New Issue
Block a user