JSPM

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

Takes an async iterator that emits things and emits them as fixed size batches

Package Exports

  • it-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-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-batch

Build status Coverage Status Dependencies Status

Takes an (async) iterable that emits things and returns an async iterable that emits those things in fixed-sized batches.

The final batch may be smaller than the max.

Install

$ npm install --save it-batch

Usage

const batch = require('it-batch')
const all = require('it-all')

// This can also be an iterator, async iterator, generator, etc
const values = [0, 1, 2, 3, 4]
const batchSize = 2

const result = await all(batch(values, batchSize))

console.info(result) // [0, 1], [2, 3], [4]