https://github.com/zcong1993/batcher
A simple batch wrapper for JS
https://github.com/zcong1993/batcher
Last synced: 8 months ago
JSON representation
A simple batch wrapper for JS
- Host: GitHub
- URL: https://github.com/zcong1993/batcher
- Owner: zcong1993
- License: mit
- Created: 2019-01-29T17:27:03.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2021-08-10T20:13:57.000Z (about 4 years ago)
- Last Synced: 2025-02-18T05:48:22.581Z (8 months ago)
- Language: TypeScript
- Size: 300 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# batcher
[](https://npmjs.com/package/@zcong/batcher) [](https://npmjs.com/package/@zcong/batcher) [](https://circleci.com/gh/zcong1993/batcher/tree/master) [](https://codecov.io/gh/zcong1993/batcher)
> A simple batch wrapper for JS
## Example
```ts
import { Batcher } from '@zcong/batcher'const bs = new Batcher(
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