https://github.com/orinak/choker
Throttle on limited rate
https://github.com/orinak/choker
rate-limiter
Last synced: 3 months ago
JSON representation
Throttle on limited rate
- Host: GitHub
- URL: https://github.com/orinak/choker
- Owner: orinak
- License: mit
- Created: 2019-10-29T18:10:48.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2019-11-04T03:04:02.000Z (over 5 years ago)
- Last Synced: 2025-02-13T14:16:48.686Z (4 months ago)
- Topics: rate-limiter
- Language: JavaScript
- Homepage:
- Size: 90.8 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
README
![]()
# choker
[](https://travis-ci.org/despan/choker)
[](https://coveralls.io/github/despan/choker?branch=master)
[](https://www.npmjs.com/package/choker)
[](https://conventionalcommits.org)
[](http://standardjs.com)
[](/LICENSE)> throttle on limited rate
### Installation
```sh
npm install choker
```### Usage
```js
const choker = require('choker')const rate = {
limit: 20,
interval: 1000 // ms
}async function sendSMS (data) {
// perform request...
return `Sent to ${data.to}`
}const smsList = [
{ to: 777888, msg: 'hi' },
// ...
]choker(rate, sendSMS, smsList)
.then(console.log)// [
// 'Sent to 777888',
// ...
// ]
```### Development
```sh
# clone repo
git clone https://github.com/despan/choker#
cd choker# install dependencies
npm install
```### Test
```sh
# run quick tests
npm run test# test watching file changes
npm run test:watch
```### Contributing
Check [Contributing Guide](/CONTRIBUTING.md).
## Acknowledgements
- Choker logo by Olena Panasovska from the Noun Project
## License
The MIT License