Socket
Book a DemoInstallSign in
Socket

limit-calls

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

limit-calls

Limit number of parallel calls to an asynchronous function

latest
Source
npmnpm
Version
1.0.0
Version published
Maintainers
1
Created
Source

limit-calls

Build Status

Limit number of parallel calls to an asynchronous function.

Installation

npm install limit-calls

Usage

var limit = require('limit-calls');

function limitMe(arg, cb) {
  // There will only ever be 2 parallel calls to this function
  console.log(arg);
  setTimeout(cb, 100);
}

var f = limit(limitMe, 2);

f('Hello world');
f('Hello world');
f('Hello world');
f('Hello world');

// Execution of this script will take around 200 ms.

Keywords

limit

FAQs

Package last updated on 09 Dec 2013

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts