diff --git a/src/functional.ts b/src/functional.ts new file mode 100644 index 0000000..05c4e57 --- /dev/null +++ b/src/functional.ts @@ -0,0 +1,8 @@ +export const sequence = (fn: ($: T) => Promise) => async (L: T[]) => { + for (const o of L) + await fn(o); +}; + +export const parallel = (fn: ($: T) => Promise) => async (L: T[]) => { + await Promise.all(L.map(fn)); +};