Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/zcong1993/batcher
A simple batch wrapper for JS
https://github.com/zcong1993/batcher
Last synced: 1 day 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 (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2021-08-10T20:13:57.000Z (about 3 years ago)
- Last Synced: 2023-02-28T14:37:10.495Z (over 1 year ago)
- Language: TypeScript
- Size: 300 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# batcher
[![NPM version](https://img.shields.io/npm/v/@zcong/batcher.svg?style=flat)](https://npmjs.com/package/@zcong/batcher) [![NPM downloads](https://img.shields.io/npm/dm/@zcong/batcher.svg?style=flat)](https://npmjs.com/package/@zcong/batcher) [![CircleCI](https://circleci.com/gh/zcong1993/batcher/tree/master.svg?style=shield)](https://circleci.com/gh/zcong1993/batcher/tree/master) [![codecov](https://codecov.io/gh/zcong1993/batcher/branch/master/graph/badge.svg)](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