takeInParallel()
function takeInParallel<T, C>(
collection,
batchSize,
callback,
abortSignal?): AsyncIterable<Awaited<ReturnType<C>>>
Given an iterable collection, returns an async iterable, executing the callback on each batch.
This is useful for batching asynchronous operations.
Type Parameters
Type Parameter |
---|
T |
C extends (entry ) => Promise <any > |
Parameters
Parameter | Type | Description |
---|---|---|
collection | Iterable <T , any , any > | The collection to batch. |
batchSize | number | The size of each batch. |
callback | C | The async callback to execute on each batch. |
abortSignal ? | AbortSignal | - |
Returns
AsyncIterable
<Awaited
<ReturnType
<C
>>>