{"_id":"p-times","_rev":"4652331","name":"p-times","description":"Run promise-returning & async functions a specific number of times concurrently","dist-tags":{"latest":"4.0.0"},"maintainers":[{"name":"sindresorhus","email":""}],"time":{"modified":"2026-04-10T20:45:30.000Z","created":"2016-10-22T14:29:18.154Z","4.0.0":"2021-06-03T09:57:13.793Z","3.0.0":"2020-04-24T16:32:40.292Z","2.1.0":"2019-04-03T05:12:34.922Z","2.0.0":"2019-03-16T17:43:34.120Z","1.0.1":"2016-10-28T17:21:46.083Z","1.0.0":"2016-10-22T14:29:18.154Z"},"users":{},"author":{"name":"Sindre Sorhus","email":"sindresorhus@gmail.com","url":"https://sindresorhus.com"},"repository":{"type":"git","url":"git+https://github.com/sindresorhus/p-times.git"},"versions":{"4.0.0":{"name":"p-times","version":"4.0.0","description":"Run promise-returning & async functions a specific number of times concurrently","license":"MIT","repository":{"type":"git","url":"git+https://github.com/sindresorhus/p-times.git"},"funding":"https://github.com/sponsors/sindresorhus","author":{"name":"Sindre Sorhus","email":"sindresorhus@gmail.com","url":"https://sindresorhus.com"},"engines":{"node":">=12.20"},"type":"module","exports":"./index.js","scripts":{"test":"xo && ava && tsd"},"keywords":["promise","times","number","count","loop","iterate","async","await","promises","concurrently","concurrency","parallel","bluebird"],"dependencies":{"p-map":"^5.0.0"},"devDependencies":{"ava":"^3.15.0","tsd":"^0.16.0","xo":"^0.40.2"},"gitHead":"dde4be7dd7e3c098567a5c9b457cac5e50296eb3","bugs":{"url":"https://github.com/sindresorhus/p-times/issues"},"homepage":"https://github.com/sindresorhus/p-times#readme","_id":"p-times@4.0.0","_nodeVersion":"12.22.1","_npmVersion":"7.10.0","dist":{"shasum":"3586dff1fc1f1a0a9f4688a7c650c5cdb4b5f0cc","size":2120,"noattachment":false,"key":"/p-times/-/p-times-4.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/p-times/download/p-times-4.0.0.tgz"},"_npmUser":{"name":"sindresorhus","email":"sindresorhus@gmail.com"},"directories":{},"maintainers":[{"name":"sindresorhus","email":""}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/p-times_4.0.0_1622714233659_0.18947810466383275"},"_hasShrinkwrap":false,"publish_time":1622714233793,"_cnpm_publish_time":1622714233793,"_cnpmcore_publish_time":"2021-12-16T18:49:00.815Z"},"3.0.0":{"name":"p-times","version":"3.0.0","description":"Run promise-returning & async functions a specific number of times concurrently","license":"MIT","repository":{"type":"git","url":"git+https://github.com/sindresorhus/p-times.git"},"funding":"https://github.com/sponsors/sindresorhus","author":{"name":"Sindre Sorhus","email":"sindresorhus@gmail.com","url":"https://sindresorhus.com"},"engines":{"node":">=10"},"scripts":{"test":"xo && ava && tsd"},"keywords":["promise","times","number","count","loop","iterate","async","await","promises","concurrently","concurrency","parallel","bluebird"],"dependencies":{"p-map":"^4.0.0"},"devDependencies":{"ava":"^1.4.1","tsd":"^0.7.2","xo":"^0.24.0"},"gitHead":"fb0b8801c09f9c6592a8ad3173919c7853985e4d","bugs":{"url":"https://github.com/sindresorhus/p-times/issues"},"homepage":"https://github.com/sindresorhus/p-times#readme","_id":"p-times@3.0.0","_nodeVersion":"10.20.1","_npmVersion":"6.14.4","_npmUser":{"name":"sindresorhus","email":"sindresorhus@gmail.com"},"dist":{"shasum":"477ff51aa8cfe7edef4cfcd4bc7e0250b13b4183","size":2378,"noattachment":false,"key":"/p-times/-/p-times-3.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/p-times/download/p-times-3.0.0.tgz"},"maintainers":[{"name":"sindresorhus","email":""}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/p-times_3.0.0_1587745960167_0.2208670983244465"},"_hasShrinkwrap":false,"publish_time":1587745960292,"_cnpm_publish_time":1587745960292,"_cnpmcore_publish_time":"2021-12-16T18:49:01.021Z"},"2.1.0":{"name":"p-times","version":"2.1.0","description":"Run promise-returning & async functions a specific number of times concurrently","license":"MIT","repository":{"type":"git","url":"git+https://github.com/sindresorhus/p-times.git"},"author":{"name":"Sindre Sorhus","email":"sindresorhus@gmail.com","url":"sindresorhus.com"},"engines":{"node":">=8"},"scripts":{"test":"xo && ava && tsd"},"keywords":["promise","times","number","count","loop","iterate","async","await","promises","concurrently","concurrency","parallel","bluebird"],"dependencies":{"p-map":"^2.0.0"},"devDependencies":{"ava":"^1.4.1","tsd":"^0.7.2","xo":"^0.24.0"},"gitHead":"781476004ffba1651362bb17b229d00295744243","bugs":{"url":"https://github.com/sindresorhus/p-times/issues"},"homepage":"https://github.com/sindresorhus/p-times#readme","_id":"p-times@2.1.0","_nodeVersion":"8.15.0","_npmVersion":"6.9.0","_npmUser":{"name":"sindresorhus","email":"sindresorhus@gmail.com"},"dist":{"shasum":"b3e7f9159f916cacb6aae06d67c79451b0076c6c","size":2257,"noattachment":false,"key":"/p-times/-/p-times-2.1.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/p-times/download/p-times-2.1.0.tgz"},"maintainers":[{"name":"sindresorhus","email":""}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/p-times_2.1.0_1554268354634_0.9214061110480409"},"_hasShrinkwrap":false,"publish_time":1554268354922,"_cnpm_publish_time":1554268354922,"_cnpmcore_publish_time":"2021-12-16T18:49:01.285Z"},"2.0.0":{"name":"p-times","version":"2.0.0","description":"Run promise-returning & async functions a specific number of times concurrently","license":"MIT","repository":{"type":"git","url":"git+https://github.com/sindresorhus/p-times.git"},"author":{"name":"Sindre Sorhus","email":"sindresorhus@gmail.com","url":"sindresorhus.com"},"engines":{"node":">=8"},"scripts":{"test":"xo && ava && tsd-check"},"keywords":["promise","times","number","count","loop","iterate","async","await","promises","concurrently","concurrency","parallel","bluebird"],"dependencies":{"p-map":"^2.0.0"},"devDependencies":{"ava":"^1.3.1","tsd-check":"^0.4.0","xo":"^0.24.0"},"gitHead":"d11ce594849d989f1210882879629e49642b7bb0","bugs":{"url":"https://github.com/sindresorhus/p-times/issues"},"homepage":"https://github.com/sindresorhus/p-times#readme","_id":"p-times@2.0.0","_nodeVersion":"8.15.0","_npmVersion":"6.9.0","_npmUser":{"name":"sindresorhus","email":"sindresorhus@gmail.com"},"dist":{"shasum":"b2b74a45d635c0f8a3a9d80fd03b1b5a5fc9497f","size":2094,"noattachment":false,"key":"/p-times/-/p-times-2.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/p-times/download/p-times-2.0.0.tgz"},"maintainers":[{"name":"sindresorhus","email":""}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/p-times_2.0.0_1552758214017_0.47028456447260236"},"_hasShrinkwrap":false,"publish_time":1552758214120,"_cnpm_publish_time":1552758214120,"_cnpmcore_publish_time":"2021-12-16T18:49:01.529Z"},"1.0.1":{"name":"p-times","version":"1.0.1","description":"Run promise-returning & async functions a specific number of times concurrently","license":"MIT","repository":{"type":"git","url":"git+https://github.com/sindresorhus/p-times.git"},"author":{"name":"Sindre Sorhus","email":"sindresorhus@gmail.com","url":"sindresorhus.com"},"engines":{"node":">=4"},"scripts":{"test":"xo && ava"},"files":["index.js"],"keywords":["promise","times","number","count","loop","iterate","async","await","promises","concurrently","concurrency","parallel","bluebird"],"dependencies":{"p-map":"^1.0.0"},"devDependencies":{"ava":"*","xo":"*"},"xo":{"esnext":true},"gitHead":"cddd5955a6f20045b4cece1df74d350e55269c05","bugs":{"url":"https://github.com/sindresorhus/p-times/issues"},"homepage":"https://github.com/sindresorhus/p-times#readme","_id":"p-times@1.0.1","_shasum":"4421472f1cb246924a66ef30fc5c810190b89c19","_from":".","_npmVersion":"2.15.9","_nodeVersion":"4.6.1","_npmUser":{"name":"sindresorhus","email":"sindresorhus@gmail.com"},"dist":{"shasum":"4421472f1cb246924a66ef30fc5c810190b89c19","size":1887,"noattachment":false,"key":"/p-times/-/p-times-1.0.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/p-times/download/p-times-1.0.1.tgz"},"maintainers":[{"name":"sindresorhus","email":""}],"_npmOperationalInternal":{"host":"packages-18-east.internal.npmjs.com","tmp":"tmp/p-times-1.0.1.tgz_1477675301768_0.459802022902295"},"directories":{},"publish_time":1477675306083,"_hasShrinkwrap":false,"_cnpm_publish_time":1477675306083,"_cnpmcore_publish_time":"2021-12-16T18:49:01.751Z"},"1.0.0":{"name":"p-times","version":"1.0.0","description":"Run promise-returning & async functions a specific number of times concurrently","license":"MIT","repository":{"type":"git","url":"git+https://github.com/sindresorhus/p-times.git"},"author":{"name":"Sindre Sorhus","email":"sindresorhus@gmail.com","url":"sindresorhus.com"},"engines":{"node":">=4"},"scripts":{"test":"xo && ava"},"files":["index.js"],"keywords":["promise","times","number","count","loop","iterate","async","await","promises","concurrently","concurrency","parallel","bluebird"],"dependencies":{"p-map":"^1.0.0"},"devDependencies":{"ava":"*","xo":"*"},"xo":{"esnext":true},"gitHead":"3b9a40e2280dd2c6c5d8b372e26132861eb42e8a","bugs":{"url":"https://github.com/sindresorhus/p-times/issues"},"homepage":"https://github.com/sindresorhus/p-times#readme","_id":"p-times@1.0.0","_shasum":"5af304d2b946d18beffb1ed7559c78d9579fef82","_from":".","_npmVersion":"2.15.9","_nodeVersion":"4.6.0","_npmUser":{"name":"sindresorhus","email":"sindresorhus@gmail.com"},"dist":{"shasum":"5af304d2b946d18beffb1ed7559c78d9579fef82","size":1904,"noattachment":false,"key":"/p-times/-/p-times-1.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/p-times/download/p-times-1.0.0.tgz"},"maintainers":[{"name":"sindresorhus","email":""}],"_npmOperationalInternal":{"host":"packages-18-east.internal.npmjs.com","tmp":"tmp/p-times-1.0.0.tgz_1477146555524_0.9325916769448668"},"directories":{},"publish_time":1477146558154,"_hasShrinkwrap":false,"_cnpm_publish_time":1477146558154,"_cnpmcore_publish_time":"2021-12-16T18:49:01.966Z"}},"readme":"# p-times\n\n> Run promise-returning & async functions a specific number of times concurrently\n\n## Install\n\n```\n$ npm install p-times\n```\n\n## Usage\n\n```js\nimport pTimes from 'p-times';\n\nconst result = await pTimes(5, index => createFixture(`????-${index + 1}`));\n\nconsole.log(`Created fixtures: ${result.join(' ')}`);\n//=> 'Created fixtures: ????-1 ????-2 ????-3 ????-4 ????-5'\n```\n\n## API\n\n### pTimes(count, mapper, options?)\n\nReturns a `Promise` that is fulfilled when all promises returned from `mapper` are fulfilled, or rejects if any of the promises reject. The fulfilled value is an `Array` of the fulfilled values returned from `mapper` in order.\n\n#### count\n\nType: `number`\n\nNumber of times to call `mapper`.\n\n#### mapper(index)\n\nType: `Function`\n\nExpected to return a `Promise` or value.\n\n#### options\n\nType: `object`\n\n##### concurrency\n\nType: `number`\\\nDefault: `Infinity`\\\nMinimum: `1`\n\nNumber of concurrently pending promises returned by `mapper`.\n\n##### stopOnError\n\nType: `boolean`\\\nDefault: `true`\n\nWhen set to `false`, instead of stopping when a promise rejects, it will wait for all the promises to settle and then reject with an [aggregated error](https://github.com/sindresorhus/aggregate-error) containing all the errors from the rejected promises.\n\n## Related\n\n- [p-forever](https://github.com/sindresorhus/p-forever) - Run promise-returning & async functions repeatedly until you end it\n- [p-map](https://github.com/sindresorhus/p-map) - Map over promises concurrently\n- [p-filter](https://github.com/sindresorhus/p-filter) - Filter promises concurrently\n- [More…](https://github.com/sindresorhus/promise-fun)\n","_attachments":{},"homepage":"https://github.com/sindresorhus/p-times#readme","bugs":{"url":"https://github.com/sindresorhus/p-times/issues"},"license":"MIT"}