{"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":{"integrity":"sha512-f3v1koF5sPfFhmI901quN9dwvHz02swCOqoAFi/DmODKARIMyOEdrUxIyAxYBS8nxf+WcbXPHrjcnel1A5suIw==","shasum":"71631d11122ac293819d083818d4ae7f3a39da4b","tarball":"http://registry-npm.ywwl.com/co-gather/download/co-gather-1.0.1.tgz","fileCount":5,"unpackedSize":5423,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJeaN3sCRA9TVsSAnZWagAAyW8P/iDda5EP4PvCIFU95s+3\nevSppX/OwWoFozZoIGUtQ3Z8QbTX2wZ3c8lLFAvgYRsPZ6Uf2twSh1zk8ykt\nLlAKolSxYPvCl8S8VoXApyP10nOA0GmhY+njdGyz5G0AoAWYylyfQyV7vBjS\nQ4SXHPSrD53WSLiVXFH0pPuROLVDxJ/5TeEBqAv6bci2b31gLYqKBHVnX9lT\ntrFx2CqkSVBMdEvTX+uMsHwykS9AvudCvwSI8aTplQ0s0WhU/11dB5M4NPDF\ny10cc9w7ZSXDxUs74Bs+g/I1trem+qONCQrrZJARrIA+5ymNIUNGSjpP/fLG\nJXscVnZf2uZ4WPqSUYFMshDfDvFImfiQC7YjEOx04jZFxI0/KWtx4v7Yyc6q\np+TXEQRD48iovNWINwXWW++1IO3mmZNhuDa2S1C7OpX8B42XKvDS+f+ppR7t\n/pfFl1uDB5qhiRdDD8NYFH1fEXMoZvovZ7lwP+D3CflAFdpRhYu6fDiUo749\na/LhpcbESFOf+e70PRmzHUrhQuO1QunO1GBZEaenKUgmFV18GXe+VWntLXHO\nFbnqYdZ3J6hU2y2Njgnjdv5nRuDI7X37a76SLz7TgvlzeOgnIyE0lWiFSGzb\nnofG8Ftv5kmEW3LFLCYsOwVw0w5Vl1FgqfWAS/6IQ7xQ/kGj8atHkUCNax5D\nXBvv\r\n=6XeN\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDMMppvL9cxt5l4LfCbQg1JTS776FILgz6+dSkO7A+RLAIhAOqKk4Pk0T9kswB4A5ai4mZDno9rj7JnqNhKK5hT97Gk"}],"size":2531,"noattachment":false,"key":"/co-gather/-/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,"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":1583930860456,"_cnpm_publish_time":1583930860456,"dist-tags":{"latest":"1.0.1"}}