{"name":"call-limit","version":"1.1.1","description":"Limit the number of simultaneous calls to an async function","main":"call-limit.js","scripts":{"test":"tap test/*.js","prerelease":"npm t","release":"standard-version -s","postrelease":"npm publish && git push --follow-tags","pretest":"iarna-standard","update-coc":"weallbehave -o . && git add CODE_OF_CONDUCT.md && git commit -m 'docs(coc): updated CODE_OF_CONDUCT.md'","update-contrib":"weallcontribute -o . && git add CONTRIBUTING.md && git commit -m 'docs(contributing): updated CONTRIBUTING.md'"},"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":"^14.2.0","weallbehave":"*","weallcontribute":"*","@iarna/standard":"*","standard-version":"*"},"gitHead":"17de3ec82fdf84a6db6ff52f45f00cd7f5c67f8d","_id":"call-limit@1.1.1","_nodeVersion":"12.3.1","_npmVersion":"6.9.0","_npmUser":{"name":"iarna","email":"me@re-becca.org"},"dist":{"integrity":"sha512-5twvci5b9eRBw2wCfPtN0GmlR2/gadZqyFpPhOK6CvMFoFgA+USnZ6Jpu1lhG9h85pQ3Ouil3PfXWRD4EUaRiQ==","shasum":"ef15f2670db3f1992557e2d965abc459e6e358d4","tarball":"http://registry-npm.ywwl.com/call-limit/download/call-limit-1.1.1.tgz","fileCount":5,"unpackedSize":7401,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJc9JI/CRA9TVsSAnZWagAAUcsP/RR6mzEqU6GJAXXOqEOC\nhjmxJjRk4f+tdncLUjL6r9g5dg1wYe0sdqSWkefhNbsYtAKtiLY56xb8ZJKf\neOHFJH2atwfX94/lfMV5d+Am5oFJd62LhB6xAkZldWSl+CMGRBedL/ggXanr\nTrPmPpLACbvOPFIKFQSiC14KHaBtw/aovEYLYkj5DI5Q+Qoj6IvACVsknHtC\nIRUtJhFsIYp6pFnxCLOzbK6Q9KYeUC4DyyDKuVd6UZ+9GB4fhNmkghQs/gnv\n7R63xxq30fZDa/y3zHEz1DdufeMLWGsXLoj/mLRI3C8DmxBz8CnQEK3XO6/2\nOlzR9E86p4c31JKLXrFOjrM9nsevh6j8zak6V5ydIFVYoOrwiyk6dHYO5+bL\nZpjdrp+g5lUXWGiqeQml6OLwZcdGga16ZvXeNtEexxNUUWTgd9keQwND/9mf\n6GwPxJNu+NGAr9OVUDnTNKOXM9h7OgbeBuiLDLW3st+it7CxqFTQUOuzyI8b\nXOCaosavTCvXahdFgdg6Ggc+UPFDd4Km5S6CkuNkamBfrjVohr6jnKh9mZ5C\nNMySp6V/dCQXmb/Ql/BP1iMXBDC1eu4GBVuJ/pEyt0mrOJpu2CX7cskkfWzX\nXbWphpvT1AgsF5SqDXcO+su5G3ZxLahm5jhKWFddgPUe4jIPKFyKLAoHCUCR\nQQzA\r\n=13Sy\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCICFw06xExXzH4SDDV5IVFVtqZ9d5ayQ8K2svrz1KacWyAiBKoqW5asG9wwjXJ9b/d+xLkZbCtcs6kI633wAEiEUPIg=="}],"size":2632,"noattachment":false,"key":"/call-limit/-/call-limit-1.1.1.tgz"},"maintainers":[{"name":"iarna","email":"me@re-becca.org"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/call-limit_1.1.1_1559532095089_0.14005293387908035"},"_hasShrinkwrap":false,"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":1559532095208,"_cnpm_publish_time":1559532095208,"dist-tags":{"latest":"1.1.1"}}