throttle on limited rate
npm install choker
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',
// ...
// ]
# clone repo
git clone https://github.com/despan/choker
#
cd choker
# install dependencies
npm install
# run quick tests
npm run test
# test watching file changes
npm run test:watch
Check Contributing Guide.
- Choker logo by Olena Panasovska from the Noun Project
The MIT License