choker

0.2.0 • Public • Published

choker

Build Status Coverage Status Published Version Commit Style Code Style GitHub

throttle on limited rate

Installation

npm install choker

Usage

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

# clone repo 
git clone https://github.com/despan/choker
 
# 
cd choker
 
# install dependencies 
npm install

Test

# run quick tests 
npm run test
 
# test watching file changes 
npm run test:watch

Contributing

Check Contributing Guide.

Acknowledgements

  • Choker logo by Olena Panasovska from the Noun Project

License

The MIT License

Package Sidebar

Install

npm i choker

Weekly Downloads

1

Version

0.2.0

License

MIT

Unpacked Size

35.9 kB

Total Files

33

Last publish

Collaborators

  • mushegha