functional: init

This commit is contained in:
2024-07-18 23:45:03 +08:00
parent 8b61cf21ef
commit 431d03624b

8
src/functional.ts Normal file
View 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));
};