{"_id":"breeze-async","_rev":"234915","name":"breeze-async","description":"Simple series and parallel flow control.","dist-tags":{"latest":"0.1.0"},"maintainers":[{"name":"jakeluer","email":""}],"time":{"modified":"2021-06-03T15:49:29.000Z","created":"2012-11-12T18:53:04.570Z","0.1.0":"2012-11-12T18:53:04.570Z"},"users":{},"author":{"name":"Jake Luer","email":"jake@qualiancy.com","url":"http://qualiancy.com"},"repository":{"type":"git","url":"git@github.com:qualiancy/breeze-async.git"},"versions":{"0.1.0":{"name":"breeze-async","version":"0.1.0","description":"Simple series and parallel flow control.","author":{"name":"Jake Luer","email":"jake@qualiancy.com","url":"http://qualiancy.com"},"license":"MIT","keywords":[],"repository":{"type":"git","url":"git@github.com:qualiancy/breeze-async.git"},"engines":{"node":"*"},"main":"./index","scripts":{"test":"make test"},"dependencies":{},"devDependencies":{"chai":"*","chai-spies":"*","component":"*","mocha":"*","mocha-phantomjs":"*"},"_id":"breeze-async@0.1.0","dist":{"shasum":"ba4265949980a3d9d8bb9137a61a42e1f87da73a","size":3769,"noattachment":false,"key":"/breeze-async/-/breeze-async-0.1.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/breeze-async/download/breeze-async-0.1.0.tgz"},"_npmVersion":"1.1.63","_npmUser":{"name":"jakeluer","email":"jake@alogicalparadox.com"},"maintainers":[{"name":"jakeluer","email":""}],"directories":{},"publish_time":1352746384570,"_cnpm_publish_time":1352746384570,"_hasShrinkwrap":false}},"readme":"# breeze-async [![Build Status](https://secure.travis-ci.org/qualiancy/breeze-async.png?branch=master)](https://travis-ci.org/qualiancy/breeze-async)\n\n> Simple series and parallel flow control.\n\n## Installation\n\n### Node.js\n\n`breeze-async` is available on [npm](http://npmjs.org).\n\n    $ npm install breeze-async\n\n### Component\n\n`breeze-async` is available as a [component](https://github.com/component/component).\n\n    $ component install qualiancy/breeze-async\n\n## Usage\n\nOnce you require `breeze-async`, the following API will be available.\n\n```js\nvar async = require('breeze-async');\n```\n\n### .forEach (array, iterator, done)\n\n* **@param** _{Array}_ array to iterate\n* **@param** _{Function}_ iterator function\n* **@param** _{Function}_ callback on complete or error\n* **@cb** _{Error|null}_ if error\n\nApply an iterator to each item in an array\nin parellel. Execute a callback when all items\nhave been completed or immediately if there is\nan error provided.\n\n```js\nasync.forEach([ 1, 2, 3 ], function (i, next) {\n  setTimeout(function () {\n    console.log(i);\n    next();\n  }, 10);\n}, function (err) {\n  should.not.exist(err);\n  console.log('all done');\n});\n```\n\n\n### .forEachSeries (array, iterator, done)\n\n* **@param** _{Array}_ array to iterate\n* **@param** _{Function}_ iterator function\n* **@param** _{Function}_ callback on complete or error\n* **@cb** _{Error|null}_ if error\n\nApply an iterator to each item in an array\nserially. Execute a callback when all items\nhave been completed or immediately if there is\nis an error provided.\n\n```js\nasync.forEachSeries([ 1, 2, 3 ], function (i, next) {\n  setTimeout(function () {\n    console.log(i);\n    next();\n  }, 10);\n}, function (err) {\n  should.not.exist(err);\n  console.log('all done');\n});\n```\n\n\n### .parallel (fns, done)\n\n* **@param** _{Array|Object}_ functions to execute\n* **@param** _{Function}_ callback on completion or error\n* **@cb** _{Error|null}_ if error\n* **@cb** _{Array|Object}_ reflecting the results\n\nExecute a collection of functions in parellel\nand execute a callback upon completion or occurance\nof an error. Functions can be provided as either\nan array or an object. Each function will be passed\na callback to signal completion. The callback accepts\neither an error for the first argument, or null for the\nfirst argument and results following. The results will be\nprovied as the second argument of the callback in-kind,\nmaintaining the order of the input array or the keys\nof the input object.\n\n##### Asrray\n\n```js\nasync.parallel([\n    function (next) {\n      setTimeout(function () {\n        next(null, 'one');\n      }, 15);\n    }\n  , function (next) {\n      setTimeout(function () {\n        next(null, 'two');\n      }, 10);\n    }\n  , function (next) {\n      setTimseout(function () {\n        next(null, 'three');\n      }, 5);\n    }s\n], function (err, res) {\n  should.not.exist(err);\n  res.should.deep.equal([ 'one', 'two', 'three' ]);\n});\n```\n\n##### Object\n\n```js\nasync.parallel({\n    one: function (next) {\n      setTimeout(function () {\n        next(null, 'one');\n      }, 15);\n    }\n  , two: function (next) {\n      setTimeout(function () {\n        next(null, 'two');\n      }, 10);\n    }\n  , three: function (next) {\n      setTimeout(function () {\n        next(null, 'three');\n      }, 5);\n    }\n}, function (err, res) {\n  should.not.exist(err);\n  res.should.deep.equal({\n      one: 'one'\n    , two: 'two'\n    , three: 'three'\n  });\n});\n```\n\n\n### series (fns, done)\n\n* **@param** _{Array|Object}_ functions to execute\n* **@param** _{Function}_ callback on completion or error\n* **@cb** _{Error|null}_ if error\n* **@cb** _{Array|Object}_ reflecting the results\n\nExecute a collection of functions serially\nand execute a callback upon completion or occurance\nof an error. Functions can be provided as either\nan array or an object. Each function will be passed\na callback to signal completion. The callback accepts\neither an error for the first argument, or null for the\nfirst argument and results following. The results will be\nprovied as the second argument of the callback in-kind,\nmaintaining the order of the input array or the keys\nof the input object.\n\n##### Asrray\n\n```js\nasync.series([\n    function (next) {\n      setTimeout(function () {\n        next(null, 'one');\n      }, 15);\n    }\n  , function (next) {\n      setTimeout(function () {\n        next(null, 'two');\n      }, 10);\n    }\n  , function (next) {\n      setTimseout(function () {\n        next(null, 'three');\n      }, 5);\n    }s\n], function (err, res) {\n  should.not.exist(err);\n  res.should.deep.equal([ 'one', 'two', 'three' ]);\n});\n```\n\n##### Object\n\n```js\nasync.series({\n    one: function (next) {\n      setTimeout(function () {\n        next(null, 'one');\n      }, 15);\n    }\n  , two: function (next) {\n      setTimeout(function () {\n        next(null, 'two');\n      }, 10);\n    }\n  , three: function (next) {\n      setTimeout(function () {\n        next(null, 'three');\n      }, 5);\n    }\n}, function (err, res) {\n  should.not.exist(err);\n  res.should.deep.equal({\n      one: 'one'\n    , two: 'two'\n    , three: 'three'\n  });\n});\n```\n\n\n\n## License\n\n(The MIT License)\n\nCopyright (c) 2012 Jake Luer <jake@qualiancy.com> (http://qualiancy.com)\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in\nall copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\nTHE SOFTWARE.\n","_attachments":{},"license":"MIT"}