{"name":"call-limit","version":"1.0.1","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":"3d8953e6080d2d1f3a08989df9889afd46b57299","_id":"call-limit@1.0.1","_shasum":"3d4770098b4ea40be364e8c62c7b45b28e7bcc20","_from":".","_npmVersion":"2.11.3","_nodeVersion":"2.3.3","_npmUser":{"name":"iarna","email":"me@re-becca.org"},"dist":{"shasum":"3d4770098b4ea40be364e8c62c7b45b28e7bcc20","tarball":"http://registry-npm.ywwl.com/call-limit/download/call-limit-1.0.1.tgz","integrity":"sha512-WQcMF+1KmZJBkX4h4Knw3Dv46UM8gJN4LuayqMkJZGPLPEctAAOVMWfbG9PgBLtlaS6dycUHCkKzL0CQO4H5aQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCiaFTH5ai5dB+EX8K7HgVHW40rNYbxxORjmKCAFHFxxgIgBbb2UpAtMvTd/l/4TQbUvGwIfiIvNoGzRAEZOycGM2o="}],"size":2067,"noattachment":false,"key":"/call-limit/-/call-limit-1.0.1.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":1437504118858,"_cnpm_publish_time":1437504118858,"dist-tags":{"latest":"1.1.1"}}