{"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":{"integrity":"sha512-GIfRsuERAAabLPXBBNzh19B3vl57d+eno4BYoR7F2DSuCcKSpp3cddmtkicolQlh7mw1LcnFRU1SAPBZUCqhHQ==","shasum":"d892593a567a38a9d3a6b2e4bb5f9f7e4d60eb3f","tarball":"http://registry-npm.ywwl.com/co-gather/download/co-gather-1.0.0.tgz","fileCount":5,"unpackedSize":5011,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbWCPuCRA9TVsSAnZWagAAky8P/0SWt3ZYqzJDSHVIqdGF\naj9i8L/zl8ShDktlLoEGhQ0t4FuAsNvwn7CBKJrb8zcqeQPTs7h4ezkyzVQ/\ncTDL502x9JP8wPI/r6C99NJd23MKrEMQ5F8xoF9/vL1ouHmrSmuof++BmJux\nw8U70OZDAVvNGihobDEOkDwxv2kJBvZ5T1j0tBvKPygUaCmAyZLQi5gBQvIv\nErLwO+7EoM6SLFtvPXIoPDqn8vSLxiEngPkQthj3JDdI0wIYaIIf5RddrlOp\nSeDSlNarypF0Ny+JRGmaJutfPgg5l3YTTlWQOvgsS0DMq7nzNfOASb2imZu+\nSW3s1qo1DPtCpx6cMzfPj4O85EuGQukFnqSZpirejm9ns4y3kFjBvZRZnuLC\nos/LxA8ToFenmYafJDUu4LXrlvs1zzCkRctFOfP+avFqgNs2dhCvYnG9Hl+X\nyNA6gAn8/uOCwR62vtMQdM0P5t6h3jSaAp1McoirtfB8GWyB8HTnHmd+L5or\noIQrfuW94jVaRAUzTLGh5e5mKX2NbX6SUcZCNtIGLKpYKUno9IHI202p7477\n1jsHL8lIKNFlUyqzVfP8Hj/Qybx+j93XAPB7+L7K6x7J6Xau7ftJafvbVtMc\nM4DhRIWCwlm+1Kd3Q4tNSEDjUx4qshszo3qJfJJPThKICB0E7FAq7fv0MKCW\n35HU\r\n=8WPA\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIDOIZwJUByX2mmNK0fQbVkWWgK9iR4Yr8K6fuEG0jtuPAiBymXAMPKd9IbsQZtkgvGyjFJPOk/Zppxm12JyPXdAksQ=="}],"size":2435,"noattachment":false,"key":"/co-gather/-/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,"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","publish_time":1532503022115,"_cnpm_publish_time":1532503022115,"dist-tags":{"latest":"1.0.1"}}