{"name":"call-limit","version":"1.0.0","description":"Limit the number of simultaneous calls to an async function","main":"index.js","scripts":{"prepublish":"babel call-limit.js --out-dir es5","test":"tap test/*.js"},"repository":{"type":"git","url":"git+https://github.com/iarna/call-limit.git"},"author":{"name":"Rebecca Turner","email":"me@re-becca.org"},"license":"ISC","bugs":{"url":"https://github.com/iarna/call-limit/issues"},"homepage":"https://npmjs.com/packages/call-limit","dependencies":{},"devDependencies":{"babel":"^5.0.2","tap":"^1.0.0"},"engine":{"node":">=0.10.x"},"gitHead":"827896d15813c9022bd0ead96000e0b2910f6020","_id":"call-limit@1.0.0","_shasum":"3cb4bbe7875b4f2267d8ec83ff51c762fdb4d292","_from":".","_npmVersion":"2.11.3","_nodeVersion":"2.3.3","_npmUser":{"name":"iarna","email":"me@re-becca.org"},"dist":{"shasum":"3cb4bbe7875b4f2267d8ec83ff51c762fdb4d292","tarball":"http://registry-npm.ywwl.com/call-limit/download/call-limit-1.0.0.tgz","integrity":"sha512-AjP9EOom97iHGZrR6n85+EQJLnjG10K0sL/HJMADtxF0tNDeb98aSpomAEfpGPCIbVqe4TzaQI37lGN/vCgG6Q==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIGC7eGfwdexEVHTP0o94ZJfWa+GQYF1hBItd/1aCu8JcAiAf6w/yOTTztEwt0hKU3egJJ9YufIf94jpcxkTDhmuTsw=="}],"size":1907,"noattachment":false,"key":"/call-limit/-/call-limit-1.0.0.tgz"},"maintainers":[{"name":"iarna","email":"me@re-becca.org"}],"directories":{},"readme":"call-limit\n----------\n\nLimit the number of simultaneous executions of a async function.\n\n```javascript\nconst fs = require('fs')\nconst limit = require('call-limit')\nconst limitedStat = limit(fs.stat, 5)\n```\n\nOr with promise returning functions:\n\n```javascript\nconst fs = Bluebird.promisifyAll(require('fs'))\nconst limit = require('call-limit')\nconst limitedStat = limit.promise(fs.statAsync, 5)\n```\n\n### USAGE:\n\nGiven that:\n\n```javascript\nconst limit = require('call-limit')\n```\n\n### limit(func, maxRunning) → limitedFunc\n\nThe returned function will execute up to maxRunning calls of `func` at once. \nBeyond that they get queued and called when the previous call completes.\n\n`func` must accept a callback as the final argument and must call it when\nit completes, or `call-limit` won't know to dequeue the next thing to run.\n\nBy contrast, callers to `limitedFunc` do NOT have to pass in a callback, but\nif they do they'll be called when `func` calls its callback.\n\n### limit.promise(func, maxRunning) → limitedFunc\n\nThe returned function will execute up to maxRunning calls of `func` at once.\nBeyond that they get queued and called when the previous call completes.\n\n`func` must return a promise.\n\n`limitedFunc` will return a promise that resolves with the promise returned\nfrom the call to `func`.\n\n### limit.method(class, methodName, maxRunning)\n\nThis is sugar for:\n\n```javascript\nclass.prototype.methodName = limit(class.prototype.methodName, maxRunning)\n```\n\n### limit.method(object, methodName, maxRunning)\n\nThis is sugar for:\n\n```javascript\nobject.methodName = limit(object.methodName, maxRunning)\n```\n\nFor example `limit.promise.method(fs, 'stat', 5)` is the same as\n`fs.stat = limit.promise(fs.stat, 5)`.\n\n### limit.promise.method(class, methodName, maxRunning)\n\nThis is sugar for:\n\n```javascript\nclass.prototype.methodName = limit.promise(class.prototype.methodName, maxRunning)\n```\n\n### limit.promise.method(object, methodName, maxRunning)\n\nThis is sugar for:\n\n```javascript\nobject.methodName = limit.promise(object.methodName, maxRunning)\n```\n\nFor example `limit.promise.method(fs, 'statAsync', 5)` is the same as\n`fs.statAsync = limit.promise(fs.statAsync, 5)`.\n","publish_time":1437376780394,"_cnpm_publish_time":1437376780394,"dist-tags":{"latest":"1.1.1"}}