{"_id":"@freik/p-limit","name":"@freik/p-limit","dist-tags":{"latest":"5.0.0"},"versions":{"5.0.0":{"name":"@freik/p-limit","version":"5.0.0","description":"Run multiple promise-returning & async functions with limited concurrency","license":"MIT","repository":{"type":"git","url":"git+https://github.com/kevinfrei/p-limit.git"},"funding":"https://github.com/sponsors/sindresorhus","bugs":{"url":"https://github.com/kevinfrei/p-limit/issues"},"author":{"name":"Kevin Frei","url":"kevinfrei@hotmail.com"},"module":"./lib/esm/index.js","main":"./lib/cjs/index.js","types":"./lib/esm/index.d.ts","engines":{"node":"^12.20.0 || ^14.13.1 || >=16.0.0"},"scripts":{"funding":"echo Go to Sindresorhus to donate money","test":"jest --config jestconfig.json","watch":"jest --watch --config jestconfig.json","clean":"rimraf lib && rimraf \".*.tsbuildinfo\"","build":"tsc --project tsconfig.cjs.json && tsc --project tsconfig.esm.json","cleanbuild":"yarn clean && yarn build","dbg":"yarn clean && tsc --sourceMap true --project tsconfig.cjs.json && tsc --sourceMap true --project tsconfig.esm.json","_postinstall":"husky install","prepublishOnly":"yarn test && yarn lint && pinst --disable","postpublish":"pinst --enable","prepare":"yarn cleanbuild","format":"prettier --write \"src/**/*.ts\" \"*.md\" \"*.json\"","lint":"eslint --fix --ext .ts src","preversion":"yarn lint","version":"yarn format && git add -A src","postversion":"git push && git push --tags --no-verify","compile":"tsc --noEmit --project tsconfig.cjs.json && tsc --noEmit --project tsconfig.esm.json","chk":"yarn format && yarn lint && yarn compile && yarn test"},"keywords":["promise","limit","limited","concurrency","throttle","rate","batch","ratelimit","task","queue","async","await","promises"],"devDependencies":{"@types/jest":"^28.1.1","@typescript-eslint/eslint-plugin":"^5.28.0","@typescript-eslint/parser":"^5.28.0","eslint":"^8.17.0","eslint-config-prettier":"^8.5.0","husky":"^8.0.1","jest":"^28.1.1","pinst":"^3.0.0","prettier":"^2.7.1","rimraf":"^3.0.2","ts-jest":"^28.0.5","typescript":"^4.7.3"},"gitHead":"f5c2dac2d882ff8fb8fc770b1e231e8a4f800b2a","homepage":"https://github.com/kevinfrei/p-limit#readme","_id":"@freik/p-limit@5.0.0","_nodeVersion":"16.15.0","_npmVersion":"8.11.0","dist":{"integrity":"sha512-XEj/59TNW1SM0qIKJr3zngErjm9pq6NVJY4Si/GhiS2X8HGkSAqW7Hv9Rm3IuZMex8sdlNaFpCKf0g12pBFJuw==","shasum":"b93245d375f8e6ac4fe4fc784de93d97c7f67e97","tarball":"https://registry.npmjs.org/@freik/p-limit/-/p-limit-5.0.0.tgz","fileCount":9,"unpackedSize":14147,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDXbYRe4FGPsDwMRuQSkqtAffrCRJEY+KB5r4MhNxxQ4gIhANroMZu/Phz3+sTeuSwa7lVPgO0LmAu6MNIFjQTWBjm3"}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJiq6YbACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmq5bg//R2oM9xZzUma5ZpUu1WLw5jQ/sR5zvlfT++dbGR8YP9yNP+kL\r\nK9LaiXq5cyFfWBgHUxdUzDn/RjWxZLVp2Uwb/ufw7bRIRbeT7utYGVonxGhD\r\neuLDRH1uGkKhnr7DxDcb4bg6ewq4UDsHUVpJJvG3jwN6kjj2Zt51BLMTCL+T\r\nCqmY3x96x1TLelV0Pw93bbwENAakP/+CweCkFg8u4cBk/sNW/2snl8laYl/Z\r\nI6Z3Vo32Uhv3pLBKb9bVAOdh8iTBTIxYGYdI3lftqID6KAWz47Ajjnuq40VO\r\n3bTTAfGu+fJI+UCZkeeCcZDV/cJQYeinETpHR+8Ni/RnNTmUd1sNpduF3aZh\r\n0IK7TWzyMUBBRD4At3z8Ip7pAzhB+Fb7a2SFInY+kJOXSFzOuk936HkFhgfK\r\n6yuyU83KrrA1zR6+Kjbmb7SHuQt+GBIQta4gG2k+Mb4v5UFQjPb06rVoGOye\r\nk/I0SvJ2Qx6EDaB24YuHIC7DmU+Bze0m/JDtiYGdtO+3i486nwR4yqGrmYOJ\r\nJT56EbaQTu3r/MSDI3A98DyxA43+G5TH4ukmlJyyp8XXe5U/1SuyNIBV/Xb+\r\nAZbamFEX37JH4Wvz25ZxTRQLMGWQ1z/BJRJUVBgqOgFa7O3sOlsx3pURQCwR\r\nX9k8ifx0xTx64fdRh6egAKU3S9PzKBWKGlY=\r\n=ULw3\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"freik","email":"kevinfrei@hotmail.com"},"directories":{},"maintainers":[{"name":"freik","email":"kevinfrei@hotmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/p-limit_5.0.0_1655416346811_0.4298603784621984"},"_hasShrinkwrap":false}},"time":{"created":"2022-06-16T21:52:26.749Z","5.0.0":"2022-06-16T21:52:26.971Z","modified":"2022-06-16T21:52:27.119Z"},"maintainers":[{"name":"freik","email":"kevinfrei@hotmail.com"}],"description":"Run multiple promise-returning & async functions with limited concurrency","homepage":"https://github.com/kevinfrei/p-limit#readme","keywords":["promise","limit","limited","concurrency","throttle","rate","batch","ratelimit","task","queue","async","await","promises"],"repository":{"type":"git","url":"git+https://github.com/kevinfrei/p-limit.git"},"author":{"name":"Kevin Frei","url":"kevinfrei@hotmail.com"},"bugs":{"url":"https://github.com/kevinfrei/p-limit/issues"},"license":"MIT","readme":"# p-limit\n\n> Run multiple promise-returning & async functions with limited concurrency\n\n> Do it for both CommonJS (electron, older Node) and ES Modules systems!\n\n## Install\n\n```\n$ npm install @freik/p-limit\n```\n\n## Usage\n\nNote: pLimit is now a named export, not a default export. (Default exports are annoying to deal with for dual-mode modules...)\n\n```js\nimport { pLimit } from 'p-limit';\n\nconst limit = pLimit(1);\n\nconst input = [\n  limit(() => fetchSomething('foo')),\n  limit(() => fetchSomething('bar')),\n  limit(() => doSomething()),\n];\n\n// Only one promise is run at once\nconst result = await Promise.all(input);\nconsole.log(result);\n```\n\n## API\n\n### pLimit(concurrency)\n\nReturns a `limit` function.\n\n#### concurrency\n\nType: `number`\\\nMinimum: `1`\\\nDefault: `Infinity`\n\nConcurrency limit.\n\n### limit(fn, ...args)\n\nReturns the promise returned by calling `fn(...args)`.\n\n#### fn\n\nType: `Function`\n\nPromise-returning/async function.\n\n#### args\n\nAny arguments to pass through to `fn`.\n\nSupport for passing arguments on to the `fn` is provided in order to be able to avoid creating unnecessary closures. You probably don't need this optimization unless you're pushing a _lot_ of functions.\n\n### limit.activeCount\n\nThe number of promises that are currently running.\n\n### limit.pendingCount\n\nThe number of promises that are waiting to run (i.e. their internal `fn` was not called yet).\n\n### limit.clearQueue()\n\nDiscard pending promises that are waiting to run.\n\nThis might be useful if you want to teardown the queue at the end of your program's lifecycle or discard any function calls referencing an intermediary state of your app.\n\nNote: This does not cancel promises that are already running.\n\n## FAQ\n\n### How is this different from the [`p-limit`](https://github.com/sindresorhus/p-limit) package?\n\nThis package is deployed as both a CommonJS and an ES Module. I work in Electron, so I need it both ways. I also live in Typescript, so I added types to the original code, and got rid of the separate type definition file.\n\nIf you like this, go to the original project author. They did most of the work.\n\nI might fork their other suff, if I ever wind up needing any of it from the Electron main process...\n","readmeFilename":"readme.md"}