{"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","tarball":"http://registry-npm.ywwl.com/co-gather/download/co-gather-0.0.1.tgz","integrity":"sha512-V5auBsoinyQfdwha8FIQuzby6m+c2899znQb4KNh7v/qCoBrD1aW/5uG/MPemdVPCxZa4ykpG6vOESW8Nbbi4w==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIEJ5YpvP3tQdMBgxwfb+nFx1vBjmMt5G8qVBy0OV33pnAiEAh31SjjU79CxCzcrwiFFhYliRZdp8JfzkJwyFcnkhpJY="}],"size":1174,"noattachment":false,"key":"/co-gather/-/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":{},"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":1394110743210,"_cnpm_publish_time":1394110743210,"dist-tags":{"latest":"1.0.1"}}