Coder Social home page Coder Social logo

choker's Introduction

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

choker's People

Contributors

antaranyan avatar

Watchers

M. avatar James Cloos avatar

choker's Issues

High resolution timers

The timestamp is not actually high-resolution. To mitigate security threats such as Spectre, browsers currently round the results to varying degrees. (Firefox started rounding to 1 millisecond in Firefox 60.) Some browsers may also slightly randomize the timestamp. The precision may improve again in future releases; browser developers are still investigating these timing attacks and how best to mitigate them.

Consider using performance.now() for browsers and process.hrtime.bigint() in Node.js.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.