Package Exports
- it-parallel-batch
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (it-parallel-batch) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
it-parallel-batch
Takes an async iterator that emits promise-returning functions, invokes them in parallel and emits the results as they become available but in the same order as the input
The final batch may be smaller than the batch size.
Install
$ npm install --save it-parallel-batch
Usage
const batch = require('it-parallel-batch')
const all = require('it-all')
const delay = require('delay')
// This can also be an iterator, async iterator, generator, etc
const input = [
async () => {
await delay(500)
return 1
},
async () => {
await delay(200)
return 2
},
async () => {
await delay(100)
return 3
}
]
const batchSize = 2
const result = await all(parallelBatch(input, batchSize))
console.info(result) // [1, 2, 3]