@zcong/batcher
TypeScript icon, indicating that this package has built-in type declarations

0.1.0 • Public • Published

batcher

NPM version NPM downloads CircleCI codecov

A simple batch wrapper for JS

Example

import { Batcher } from '@zcong/batcher'

const bs = new Batcher<string>(
  1000,
  10000,
  (batch: string[]) => {
    console.log(batch.length)
  },
  (str: string) => str.length
)

Array(100)
  .fill('nasjxkajsnxkjanskxnksanxkjsnakxs')
  .forEach(s => bs.dispatch(s))

setTimeout(() => bs.stop(), 9000)
// 31
// 31
// 31
// 7

License

MIT © zcong1993

Dependencies (0)

    Dev Dependencies (9)

    Package Sidebar

    Install

    npm i @zcong/batcher

    Weekly Downloads

    0

    Version

    0.1.0

    License

    MIT

    Unpacked Size

    7.75 kB

    Total Files

    10

    Last publish

    Collaborators

    • zcong