{"name":"call-limit","version":"1.1.0","description":"Limit the number of simultaneous calls to an async function","main":"call-limit.js","scripts":{"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":{"tap":"^1.0.0"},"files":["call-limit.js"],"gitHead":"2b05fe72f0cf33a2aac951cd68dd949fccb0d9e9","_id":"call-limit@1.1.0","_shasum":"6fd61b03f3da42a2cd0ec2b60f02bd0e71991fea","_from":".","_npmVersion":"4.4.1","_nodeVersion":"7.7.1","_npmUser":{"name":"iarna","email":"me@re-becca.org"},"dist":{"shasum":"6fd61b03f3da42a2cd0ec2b60f02bd0e71991fea","tarball":"http://registry-npm.ywwl.com/call-limit/download/call-limit-1.1.0.tgz","integrity":"sha512-2waS4t+GBOSXb5hZyPRjo1m2ndtQUwMj1rIYa3XnLnFlfd5uNnxo3nyPQF+i7yDpgz95ed9Ga6hpgVXi+0oMeA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQD2yVLxdrDjdEBqPfo2fYnYdUafsqXjVpTMhP2jaN75TwIhAKpTv6ifS9wrzM2uPUyjA80fFzuUzrFJieUs/CEmEw7v"}],"size":1619,"noattachment":false,"key":"/call-limit/-/call-limit-1.1.0.tgz"},"maintainers":[{"name":"iarna","email":"me@re-becca.org"}],"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/call-limit-1.1.0.tgz_1488849297527_0.29955350141972303"},"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":1488849297803,"_cnpm_publish_time":1488849297803,"dist-tags":{"latest":"1.1.1"}}