0.1.0 • Published 5 years ago

@zcong/batcher v0.1.0

Weekly downloads
-
License
MIT
Repository
-
Last release
5 years ago

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