JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 52071
  • Score
    100M100P100Q157478F
  • License ISC

Takes an async iterator that emits promise-returning functions, invokes them in parallel and emits the results in the same order as the input

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

Build status Coverage Status Dependencies Status

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]