This repo contains functions that makes it easy to program with AsyncGenerators
in a functional programming friendly way.
API
-
flatten
<T>(array: AsyncGenerator<T, any, unknown>[]) => AsyncGenerator<T, void, unknown>
-
generate
<T, R>(fn: (el: T, index?: number, arr?: T[]) => Promise<R>) => (arr: T[]) => AsyncGenerator<R, void, unknown>
-
iterate
<T>(generator: AsyncGenerator<T, any, unknown>) => (fn: IterateFn<T>) => Promise<void>
-
iterateSync
eachFn
anddoneFn
are synchronous function rather than returning a promise.