{"_id":"co-gather","_rev":"3018713","name":"co-gather","description":"Execute thunks in parallel with concurrency support and gather all the results","dist-tags":{"latest":"1.0.1"},"maintainers":[{"name":"dead_horse","email":"dead_horse@qq.com"}],"time":{"modified":"2023-11-07T03:32:27.000Z","created":"2014-03-06T12:59:03.210Z","1.0.1":"2020-03-11T12:47:40.456Z","1.0.0":"2018-07-25T07:17:02.115Z","0.0.1":"2014-03-06T12:59:03.210Z"},"users":{"liunian":true},"author":{"name":"dead_horse","email":"dead_horse@qq.com","url":"http://deadhorse.me"},"repository":{"type":"git","url":"git://github.com/cojs/gather.git"},"versions":{"1.0.1":{"name":"co-gather","version":"1.0.1","description":"Execute thunks in parallel with concurrency support and gather all the results","main":"index.js","scripts":{"test":"egg-bin test","ci":"egg-bin cov"},"repository":{"type":"git","url":"git://github.com/cojs/gather.git"},"keywords":["co","parallel","gather","koa"],"author":{"name":"dead_horse","email":"dead_horse@qq.com","url":"http://deadhorse.me"},"license":"MIT","bugs":{"url":"https://github.com/cojs/gather/issues"},"homepage":"https://github.com/cojs/gather","dependencies":{"co":"^4.6.0"},"devDependencies":{"egg-bin":"^4.7.1","egg-ci":"^1.8.0","mz-modules":"^2.1.0"},"ci":{"version":"8, 10"},"gitHead":"53197a43fd1777b35d69c90eea7c16952a358f5b","_id":"co-gather@1.0.1","_nodeVersion":"10.16.0","_npmVersion":"6.12.0","dist":{"shasum":"71631d11122ac293819d083818d4ae7f3a39da4b","size":2531,"noattachment":false,"key":"/co-gather/-/co-gather-1.0.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/co-gather/download/co-gather-1.0.1.tgz"},"maintainers":[{"name":"dead_horse","email":"dead_horse@qq.com"}],"_npmUser":{"name":"dead_horse","email":"dead_horse@qq.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/co-gather_1.0.1_1583930860333_0.6749498718700726"},"_hasShrinkwrap":false,"publish_time":1583930860456,"_cnpm_publish_time":1583930860456,"_cnpmcore_publish_time":"2021-12-16T17:21:47.256Z"},"1.0.0":{"name":"co-gather","version":"1.0.0","description":"Execute thunks in parallel with concurrency support and gather all the results","main":"index.js","scripts":{"test":"egg-bin test","ci":"egg-bin cov"},"repository":{"type":"git","url":"git://github.com/cojs/gather.git"},"files":["index.js"],"keywords":["co","parallel","gather","koa"],"author":{"name":"dead_horse","email":"dead_horse@qq.com","url":"http://deadhorse.me"},"license":"MIT","bugs":{"url":"https://github.com/cojs/gather/issues"},"homepage":"https://github.com/cojs/gather","dependencies":{"co":"^4.6.0"},"devDependencies":{"egg-bin":"^4.7.1","egg-ci":"^1.8.0","mz-modules":"^2.1.0"},"ci":{"version":"8, 10"},"gitHead":"870329c75334c2ec8914070addf84639accb67c0","_id":"co-gather@1.0.0","_npmVersion":"5.8.0","_nodeVersion":"8.11.1","_npmUser":{"name":"dead_horse","email":"dead_horse@qq.com"},"dist":{"shasum":"d892593a567a38a9d3a6b2e4bb5f9f7e4d60eb3f","size":2435,"noattachment":false,"key":"/co-gather/-/co-gather-1.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/co-gather/download/co-gather-1.0.0.tgz"},"maintainers":[{"name":"dead_horse","email":"dead_horse@qq.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/co-gather_1.0.0_1532503022013_0.5818835897790307"},"_hasShrinkwrap":false,"publish_time":1532503022115,"_cnpm_publish_time":1532503022115},"0.0.1":{"name":"co-gather","version":"0.0.1","description":"Execute thunks in parallel with concurrency support and gather all the results","main":"index.js","scripts":{"test":"make test"},"repository":{"type":"git","url":"git://github.com/dead-horse/co-gather.git"},"files":["index.js"],"keywords":["co","parallel","gather","koa"],"author":{"name":"dead_horse","email":"dead_horse@qq.com","url":"http://deadhorse.me"},"license":"MIT","bugs":{"url":"https://github.com/dead-horse/co-gather/issues"},"homepage":"https://github.com/dead-horse/co-gather","devDependencies":{"co":"^3.0.2","co-wait":"^0.0.0"},"dependencies":{"co-thread":"0.0.1"},"_id":"co-gather@0.0.1","dist":{"shasum":"efa35fbef02c9f647d8a740b3f5db731862535bc","size":1174,"noattachment":false,"key":"/co-gather/-/co-gather-0.0.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/co-gather/download/co-gather-0.0.1.tgz"},"_from":".","_npmVersion":"1.4.4","_npmUser":{"name":"dead_horse","email":"dead_horse@qq.com"},"maintainers":[{"name":"dead_horse","email":"dead_horse@qq.com"}],"directories":{},"publish_time":1394110743210,"_cnpm_publish_time":1394110743210,"_hasShrinkwrap":false}},"readme":"co-gather\n=========\n\nExecute thunks, generators, async functions in parallel with concurrency support and gather all the results.\n\n`co-gather` is similar with [co-parallel](https://github.com/visionmedia/co-parallel), but `co-gather` will gather all the result of these thunks, even those thunks throw error.\n\n## Installation\n\n```\n$ npm install co-gather\n```\n\n## Example\n\n```js\nconst gather = require('./');\nconst sleep = require('mz-modules/sleep');\n\nfunction* gfun(result, error, interval) {\n  yield sleep(interval || 100);\n  if (error) throw new Error(error);\n  return result;\n}\n\nasync function afun(result, error, interval) {\n  await sleep(interval || 100);\n  if (error) throw new Error(error);\n  return result;\n}\n\nconsole.time('gather');\ngather([\n  gfun(1),\n  gfun(null, 'error'),\n  async () => afun(null, 'error'),\n  () => afun(4),\n], 2).then(res => {\n  console.timeEnd('gather');\n  console.log(res);\n});\n```\n\n=>\n\n```\n[\n  { isError: false, value: 1 },\n  { isError: true, error: [Error: error] },\n  { isError: true, error: [Error: error] },\n  { isError: false, value: 4 }\n]\n```\n\n## API\n\n\n## gather(items, [concurrency])\n\nExecute `items` in parallel, with the given concurrency defaulting to 5, and gather the result\n\n## License\n\nMIT\n","_attachments":{},"homepage":"https://github.com/cojs/gather","bugs":{"url":"https://github.com/cojs/gather/issues"},"license":"MIT"}