An efficient promise executor'
This library allows to efficiently apply a potentially expensive function to all the elements of an iterable source.
// To dump the results of the operation into an array, use `all` // pauses for `ms` millis. // An iterable source.; // An expensive function // Maximum number of `expensiveFunction` that will be running at a time.; // defaults to 32 // results is of type Array<number>;
all
returns a promise. It will be rejected if any error occurs while retrieving data from the source, or while executing the function.
For advanced functionality, execute
returns an asynchronous generator that traverses the source according to the concurrency
and backpressure
settings.
// pauses for `ms` millis. // An asynchronous iterable source. // An expensive function // Maximum number of `expensiveFunction` that will be running at a time.; // defaults to 32 // If `false`, as `expensiveFunction` finishes for the first `concurrency` values of// the source generator, the results are stored in a buffer and more values are// requested. Repeats until the source generator finishes.// If `true` the source generator won't be traversed if the one returned by// `execute` isn't.; // defaults to false // iteratefor await of executesource, expensiveFunction, concurrency, backpressure