Skip to content

orinak/choker

Repository files navigation

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