{"_id":"steed","_rev":"18-33af687c90df2586ebf85de99475ce4d","name":"steed","description":"horsepower for your modules","dist-tags":{"latest":"1.1.3"},"versions":{"0.0.1":{"name":"steed","version":"0.0.1","description":"Let's put a horse in your JS! A Control-Flow library for JS that make your application faster","main":"steed.js","scripts":{"test":"tape test.js | tap-spec"},"repository":{"type":"git","url":"git+https://github.com/mcollina/steed.git"},"keywords":["control","flow","async","series","parallel"],"author":{"name":"Matteo Collina","email":"hello@matteocollina.com"},"license":"MIT","bugs":{"url":"https://github.com/mcollina/steed/issues"},"homepage":"https://github.com/mcollina/steed#readme","devDependencies":{"tap-spec":"^4.1.0","tape":"^4.2.2"},"gitHead":"65834dea326963cf8c822464ddbaf7c0700f9359","_id":"steed@0.0.1","_shasum":"bead0cbefcbd40f16e48d603e71842e2994cbb4c","_from":".","_npmVersion":"2.14.7","_nodeVersion":"4.2.0","_npmUser":{"name":"matteo.collina","email":"hello@matteocollina.com"},"dist":{"shasum":"bead0cbefcbd40f16e48d603e71842e2994cbb4c","tarball":"https://registry.npmjs.org/steed/-/steed-0.0.1.tgz","integrity":"sha512-68wm7RPPKa8/yM94tEo9Mp+mROF1HOC6+u1/Fa2xBNivpCHwcXoYbBojoqdqEGDLg1Gg0zXKrk7FauPsqPn8UA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCkSQ5t+EYSsebs6kShG3+VX0A8UWbZTrunuwYUCncaywIhAPHJA1ACsJxiotCUqwDMRqf/3wINOz+MkZAaLzjvNMtT"}]},"maintainers":[{"name":"matteo.collina","email":"hello@matteocollina.com"}]},"1.0.0":{"name":"steed","version":"1.0.0","description":"horsepower for your modules","main":"steed.js","scripts":{"test":"standard && tape test.js | tap-spec"},"repository":{"type":"git","url":"git+https://github.com/mcollina/steed.git"},"keywords":["control","flow","async","series","parallel"],"author":{"name":"Matteo Collina","email":"hello@matteocollina.com"},"license":"MIT","bugs":{"url":"https://github.com/mcollina/steed/issues"},"homepage":"https://github.com/mcollina/steed#readme","devDependencies":{"standard":"^5.4.1","tap-spec":"^4.1.0","tape":"^4.2.2"},"dependencies":{"fastfall":"^1.4.0","fastparallel":"^2.1.0","fastq":"^1.3.0","fastseries":"^1.6.0","reusify":"^1.0.0"},"gitHead":"b1bf500b8c63b2bf7badf0d8b3d3fbc88e3e62ed","_id":"steed@1.0.0","_shasum":"b764398211e9ce3df7b118d01e6ef16e53a52fc5","_from":".","_npmVersion":"2.14.7","_nodeVersion":"4.2.0","_npmUser":{"name":"matteo.collina","email":"hello@matteocollina.com"},"dist":{"shasum":"b764398211e9ce3df7b118d01e6ef16e53a52fc5","tarball":"https://registry.npmjs.org/steed/-/steed-1.0.0.tgz","integrity":"sha512-i2nJoYue1k+qI9nHXMYryi01h9BS+UW85SX2V+sw6Xerh9yQ3FgTRW5yQgSPMWZbZ09+QNUVMIr9D7YiMQOJeA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCt+JWZc0zPBPVr0E4OXRN3HlMk9iwRY9bZnkPr967JtgIhANOA4oaP9dxLUcqRurPZgwL41L0MgHe3XlDv+j/vhCLT"}]},"maintainers":[{"name":"matteo.collina","email":"hello@matteocollina.com"}]},"1.0.1":{"name":"steed","version":"1.0.1","description":"horsepower for your modules","main":"steed.js","scripts":{"test":"standard && tape test.js | tap-spec"},"repository":{"type":"git","url":"git+https://github.com/mcollina/steed.git"},"keywords":["control","flow","async","series","parallel"],"author":{"name":"Matteo Collina","email":"hello@matteocollina.com"},"license":"MIT","bugs":{"url":"https://github.com/mcollina/steed/issues"},"homepage":"https://github.com/mcollina/steed#readme","devDependencies":{"standard":"^5.4.1","tap-spec":"^4.1.0","tape":"^4.2.2"},"dependencies":{"fastfall":"^1.4.0","fastparallel":"^2.1.0","fastq":"^1.3.0","fastseries":"^1.6.0","reusify":"^1.0.0"},"gitHead":"7cf9fe084fa14cdaa1b475162f09ccdd966291e0","_id":"steed@1.0.1","_shasum":"a401bc8f1c062d988a363cc1d928a6b0f9efea0e","_from":".","_npmVersion":"2.14.7","_nodeVersion":"4.2.0","_npmUser":{"name":"matteo.collina","email":"hello@matteocollina.com"},"dist":{"shasum":"a401bc8f1c062d988a363cc1d928a6b0f9efea0e","tarball":"https://registry.npmjs.org/steed/-/steed-1.0.1.tgz","integrity":"sha512-90gL+03RAu2scenvLZ+Uv7EHUZbGenDl8vGSm4DxmnMwElMOX28ZP7aYntW+uxQxBazy2ktpw0w7K//7IzkO2g==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQC/NMcUuKVtXjMuE8QwUq/8dh9CvkO5ZaMWWH3qBroIQgIgd2AoFrdQYUklMwlnMS9mX8Al+odZKfcCNcsm5HeK194="}]},"maintainers":[{"name":"matteo.collina","email":"hello@matteocollina.com"}]},"1.0.2":{"name":"steed","version":"1.0.2","description":"horsepower for your modules","main":"steed.js","scripts":{"test":"standard && tape test.js | tap-spec"},"repository":{"type":"git","url":"git+https://github.com/mcollina/steed.git"},"keywords":["control","flow","async","series","parallel"],"author":{"name":"Matteo Collina","email":"hello@matteocollina.com"},"license":"MIT","bugs":{"url":"https://github.com/mcollina/steed/issues"},"homepage":"https://github.com/mcollina/steed#readme","devDependencies":{"standard":"^5.4.1","tap-spec":"^4.1.0","tape":"^4.2.2"},"dependencies":{"fastfall":"^1.4.0","fastparallel":"^2.1.0","fastq":"^1.3.0","fastseries":"^1.6.0","reusify":"^1.0.0"},"gitHead":"3fbf4a9e16063c0846bdf9c0b8baba90894c2358","_id":"steed@1.0.2","_shasum":"d91d4b23ebb657096addc48e7e08cc609a25531b","_from":".","_npmVersion":"2.14.7","_nodeVersion":"4.2.0","_npmUser":{"name":"matteo.collina","email":"hello@matteocollina.com"},"dist":{"shasum":"d91d4b23ebb657096addc48e7e08cc609a25531b","tarball":"https://registry.npmjs.org/steed/-/steed-1.0.2.tgz","integrity":"sha512-pZ+lSH9595GH/tvRTzyz7p7sD/013nGNZR6sRof1PlvGQsnMPL/JLA1ImthDgMi1HfgFETaBLtfDRcqf8WafYQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQC2xeY15shMzTA+IOyIaD1W/gjPspadUgvnHCxosD44lQIhAPtIN/0RE51bBTazh8xHO79h/yNWasbnvcXzymuS4R8n"}]},"maintainers":[{"name":"matteo.collina","email":"hello@matteocollina.com"}]},"1.1.0":{"name":"steed","version":"1.1.0","description":"horsepower for your modules","main":"steed.js","scripts":{"test":"standard && tape test.js | tap-spec"},"repository":{"type":"git","url":"git+https://github.com/mcollina/steed.git"},"keywords":["control","flow","async","series","parallel"],"author":{"name":"Matteo Collina","email":"hello@matteocollina.com"},"license":"MIT","bugs":{"url":"https://github.com/mcollina/steed/issues"},"homepage":"https://github.com/mcollina/steed#readme","devDependencies":{"fastbench":"^1.0.0","neo-async":"^1.7.0","standard":"^5.4.1","tap-spec":"^4.1.0","tape":"^4.2.2"},"dependencies":{"fastfall":"^1.4.0","fastparallel":"^2.2.0","fastq":"^1.3.0","fastseries":"^1.7.0","reusify":"^1.0.0"},"gitHead":"aec1d29d8315f46ff609834aa975f41b779eb0a7","_id":"steed@1.1.0","_shasum":"442e219e6a21cfc1e4efb31a334e58f40d05689d","_from":".","_npmVersion":"2.14.7","_nodeVersion":"4.2.0","_npmUser":{"name":"matteo.collina","email":"hello@matteocollina.com"},"dist":{"shasum":"442e219e6a21cfc1e4efb31a334e58f40d05689d","tarball":"https://registry.npmjs.org/steed/-/steed-1.1.0.tgz","integrity":"sha512-DrEiwDUnEfHViZ1i1MU6TSSKERjHnA4/xeqdQUG6w9Ce9XkMBq+veHLi9fWrrnTgrJCSncuiXWVMDj7WmWCTdA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIAD7qNOkWvn3/ambG2+PIOuhXkB9N64M/3kdfBp05WC0AiAWqNTdLmsaW1eBJIXAYJnC4P5oXIZ/hdAa1Usob+txTA=="}]},"maintainers":[{"name":"matteo.collina","email":"hello@matteocollina.com"}]},"1.1.1":{"name":"steed","version":"1.1.1","description":"horsepower for your modules","main":"steed.js","scripts":{"test":"standard && tape test.js | tap-spec"},"repository":{"type":"git","url":"git+https://github.com/mcollina/steed.git"},"keywords":["control","flow","async","series","parallel"],"author":{"name":"Matteo Collina","email":"hello@matteocollina.com"},"license":"MIT","bugs":{"url":"https://github.com/mcollina/steed/issues"},"homepage":"https://github.com/mcollina/steed#readme","devDependencies":{"fastbench":"^1.0.0","neo-async":"^1.7.0","standard":"^5.4.1","tap-spec":"^4.1.0","tape":"^4.2.2"},"dependencies":{"fastfall":"^1.4.0","fastparallel":"^2.2.0","fastq":"^1.3.0","fastseries":"^1.7.0","reusify":"^1.0.0"},"gitHead":"72f5e6e80314bbfbee42f9ea6ddf113fcb38aa3f","_id":"steed@1.1.1","_shasum":"70ebb96648e29a10678a05fc52b897882163c2ce","_from":".","_npmVersion":"2.14.7","_nodeVersion":"4.2.0","_npmUser":{"name":"matteo.collina","email":"hello@matteocollina.com"},"dist":{"shasum":"70ebb96648e29a10678a05fc52b897882163c2ce","tarball":"https://registry.npmjs.org/steed/-/steed-1.1.1.tgz","integrity":"sha512-dEbj01ujIgwVGkT8Qkml9CactjO5QahbHDCNl5kmVyvmGQNGGarfg55cFlWaamXzIPAXqjLkJgITAe5gTLDUxg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCa9TfWgHVzOxyeMDTrAby8W1bvG174c+//CAHWV56mxgIhAIgilvjvsA0EZDqBoOonL8mGx3eTcnHZFuh9asxyQzlN"}]},"maintainers":[{"name":"matteo.collina","email":"hello@matteocollina.com"}]},"1.1.2":{"name":"steed","version":"1.1.2","description":"horsepower for your modules","main":"steed.js","scripts":{"test":"standard && tape test.js | tap-spec"},"repository":{"type":"git","url":"git+https://github.com/mcollina/steed.git"},"keywords":["control","flow","async","series","parallel"],"author":{"name":"Matteo Collina","email":"hello@matteocollina.com"},"license":"MIT","bugs":{"url":"https://github.com/mcollina/steed/issues"},"homepage":"https://github.com/mcollina/steed#readme","devDependencies":{"fastbench":"^1.0.0","neo-async":"^1.7.0","standard":"^5.4.1","tap-spec":"^4.1.0","tape":"^4.2.2"},"dependencies":{"fastfall":"^1.5.0","fastparallel":"^2.2.0","fastq":"^1.3.0","fastseries":"^1.7.0","reusify":"^1.0.0"},"gitHead":"cae6f58127e8bb9241941c2a3d6a9e3629b70990","_id":"steed@1.1.2","_shasum":"c25cb869213adfef81650644233d6b7bf0f1a0a5","_from":".","_npmVersion":"3.4.1","_nodeVersion":"4.2.0","_npmUser":{"name":"matteo.collina","email":"hello@matteocollina.com"},"dist":{"shasum":"c25cb869213adfef81650644233d6b7bf0f1a0a5","tarball":"https://registry.npmjs.org/steed/-/steed-1.1.2.tgz","integrity":"sha512-IZV+LEdEVeTJ5JNaMJ/DQl76siVbS3zS7l+Bxwgp0CxMa9zyEdJDoUgpxtHdC0RSBHfay62Gii9bqkGe5osqRw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCMadWemRd+9+rEy9vb7HPFiKggCO+hH0+j2/iRu+irBAIgXmbbvy08Dygyn9Ztjs8OFm/e6PhXNY7IoCxw5peZhYE="}]},"maintainers":[{"name":"matteo.collina","email":"hello@matteocollina.com"}]},"1.1.3":{"name":"steed","version":"1.1.3","description":"horsepower for your modules","main":"steed.js","scripts":{"test":"standard && tape test.js | tap-spec","coverage":"istanbul cover tape test.js; cat coverage/lcov.info | coveralls"},"repository":{"type":"git","url":"git+https://github.com/mcollina/steed.git"},"keywords":["control","flow","async","series","parallel"],"author":{"name":"Matteo Collina","email":"hello@matteocollina.com"},"license":"MIT","bugs":{"url":"https://github.com/mcollina/steed/issues"},"homepage":"https://github.com/mcollina/steed#readme","devDependencies":{"coveralls":"^2.11.6","fastbench":"^1.0.0","istanbul":"^0.4.1","neo-async":"^1.7.0","standard":"^5.4.1","tap-spec":"^4.1.0","tape":"^4.2.2"},"dependencies":{"fastfall":"^1.5.0","fastparallel":"^2.2.0","fastq":"^1.3.0","fastseries":"^1.7.0","reusify":"^1.0.0"},"gitHead":"1bf30bbb18f5d7dae683009a01b40dbbb6636a6e","_id":"steed@1.1.3","_shasum":"f1525dd5adb12eb21bf74749537668d625b9abc5","_from":".","_npmVersion":"2.14.12","_nodeVersion":"4.2.4","_npmUser":{"name":"matteo.collina","email":"hello@matteocollina.com"},"dist":{"shasum":"f1525dd5adb12eb21bf74749537668d625b9abc5","tarball":"https://registry.npmjs.org/steed/-/steed-1.1.3.tgz","integrity":"sha512-EUkci0FAUiE4IvGTSKcDJIQ/eRUP2JJb56+fvZ4sdnguLTqIdKjSxUe138poW8mkvKWXW2sFPrgTsxqoISnmoA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIG1hzxX2khKJ2ilJD1kx8OXUCUlT1lu1jkOzU7+CR3eIAiEA1lW0pQ66b43LLp+nC/0Otuxca3VIoY2d9dJvV96CSaY="}]},"maintainers":[{"name":"matteo.collina","email":"hello@matteocollina.com"}],"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/steed-1.1.3.tgz_1458316014659_0.007901560747995973"}}},"readme":"![logo][logo-url]\n\n# steed\n\n[![npm version][npm-badge]][npm-url]\n[![Build Status][travis-badge]][travis-url]\n[![Coverage Status][coveralls-badge]][coveralls-url]\n[![Dependency Status][david-badge]][david-url]\n\nHorsepower for your modules.\n\n__Steed__ is an alternative to [async](http://npm.im/async) that is\n~50-100% faster. It is not currently on-par with async in term of features.\nPlease help us!\n\n* <a href=\"#install\">Installation</a>\n* <a href=\"#api\">API</a>\n* <a href=\"#caveats\">Caveats</a>\n* <a href=\"#why\">Why it is so fast?</a>\n* <a href=\"#acknowledgements\">Acknowledgements</a>\n* <a href=\"#licence\">Licence &amp; copyright</a>\n\n[![js-standard-style](https://raw.githubusercontent.com/feross/standard/master/badge.png)](https://github.com/feross/standard)\n\nWatch Matteo presenting Steed at Node.js Interactive 2015: https://www.youtube.com/watch?v=_0W_822Dijg.\n\n## Install\n\n`npm i steed --save`\n\n## API\n\n* <a href=\"#steed\"><code><b>steed()</b></code></a>\n* <a href=\"#parallel\"><code>steed#<b>parallel()</b></code></a>\n* <a href=\"#series\"><code>steed#<b>series()</b></code></a>\n* <a href=\"#waterfall\"><code>steed#<b>waterfall()</b></code></a>\n* <a href=\"#each\"><code>steed#<b>each()</b></code></a>\n* <a href=\"#eachSeries\"><code>steed#<b>eachSeries()</b></code></a>\n* <a href=\"#map\"><code>steed#<b>map()</b></code></a>\n* <a href=\"#mapSeries\"><code>steed#<b>mapSeries()</b></code></a>\n* <a href=\"#queue\"><code>steed#<b>queue()</b></code></a>\n\n-------------------------------------------------------\n<a name=\"steed\"></a>\n### steed()\n\nBuild an instance of steed, this step is not needed but welcomed for\ngreater performance. Each steed utility likes being used for the same\npurpose.\n\n-------------------------------------------------------\n<a name=\"parallel\"></a>\n### steed.parallel([that,] tasks[, done(err, results)])\n\nExecutes a series of tasks in parallel.\n\n`tasks` can either be an array of functions, or an object where each\nproperty is a function. `done` will be called with the results.\nThe `that` argument will set `this` for each task and `done` callback.\n\nUses [fastparallel](http://npm.im/fastparallel).\n\nExample:\n\n```js\nvar steed = require('steed')()\n// or\n// var steed = require('steed')\n\nsteed.parallel([\n  function a (cb){\n    cb(null, 'a');\n  },\n  function b (cb){\n    cb(null, 'b');\n  }\n], function(err, results){\n  // results is ['a', 'b']\n})\n\n\n// an example using an object instead of an array\nsteed.parallel({\n  a: function a1 (cb){\n    cb(null, 1)\n  },\n  b: function b1 (cb){\n    cb(null, 2)\n  }\n}, function(err, results) {\n  // results is  { a: 1, b: 2}\n})\n\n// an example using that parameter\n// preferred form for max speed\nfunction run (prefix, a, b, cb) {\n  steed.parallel(new State(prefix, a, b, cb), [aT, bT], doneT)\n}\n\n// can be optimized by V8 using an hidden class\nfunction State (prefix, a, b, cb) {\n  this.a = a\n  this.b = b\n  this.cb = cb\n  this.prefix = prefix\n}\n\n// because it is not a closure inside run()\n// v8 can optimize this function\nfunction aT (cb){\n  cb(null, this.a);\n}\n\n// because it is not a closure inside run()\n// v8 can optimize this function\nfunction bT (cb){\n  cb(null, this.b);\n}\n\n// because it is not a closure inside run()\n// v8 can optimize this function\nfunction doneT (err, results) {\n  if (results) {\n    results.unshift(this.prefix)\n    results = results.join(' ')\n  }\n  this.cb(err, results)\n}\n\nrun('my name is', 'matteo', 'collina', console.log)\n```\n\nBenchmark for doing 3 calls `setImmediate` 1 million times:\n\n* non-reusable `setImmediate`: 1781ms\n* `async.parallel`: 3484ms\n* `neoAsync.parallel`: 2162ms\n* `insync.parallel`: 10252ms\n* `items.parallel`: 3725ms\n* `parallelize`: 2928ms\n* `fastparallel` with results: 2139ms\n\nThese benchmarks where taken on node v4.1.0, on a MacBook\nPro Retina Mid 2014 (i7, 16GB of RAM).\n\n-------------------------------------------------------\n<a name=\"series\"></a>\n### steed.series([that,] tasks[, done(err, results)])\n\nExecutes a series of tasks in series.\n\n`tasks` can either be an array of functions, or an object where each\nproperty is a function. `done` will be called with the results.\nThe `that` argument will set `this` for each task and `done` callback.\n\nUses [fastseries](http://npm.im/fastseries).\n\nExample:\n\n```js\nvar steed = require('steed')()\n// or\n// var steed = require('steed')\n\nsteed.series([\n  function a (cb){\n    cb(null, 'a');\n  },\n  function b (cb){\n    cb(null, 'b');\n  }\n], function(err, results){\n  // results is ['a', 'b']\n})\n\n\n// an example using an object instead of an array\nsteed.series({\n  a: function a (cb){\n    cb(null, 1)\n  },\n  b: function b (cb){\n    cb(null, 2)\n  }\n}, function(err, results) {\n  // results is  { a: 1, b: 2}\n})\n\n// an example using that parameter\n// preferred form for max speed\nfunction run (prefix, a, b, cb) {\n  steed.series(new State(prefix, a, b, cb), [aT, bT], doneT)\n}\n\n// can be optimized by V8 using an hidden class\nfunction State (prefix, a, b, cb) {\n  this.a = a\n  this.b = b\n  this.cb = cb\n  this.prefix = prefix\n}\n\n// because it is not a closure inside run()\n// v8 can optimize this function\nfunction aT (cb){\n  cb(null, this.a);\n}\n\n// because it is not a closure inside run()\n// v8 can optimize this function\nfunction bT (cb){\n  cb(null, this.b);\n}\n\n// because it is not a closure inside run()\n// v8 can optimize this function\nfunction doneT (err, results) {\n  if (results) {\n    results.unshift(this.prefix)\n    results = results.join(' ')\n  }\n  this.cb(err, results)\n}\n\nrun('my name is', 'matteo', 'collina', console.log)\n```\n\nBenchmark for doing 3 calls `setImmediate` 1 million times:\n\n* non-reusable `setImmediate`: 3887ms\n* `async.series`: 5981ms\n* `neoAsync.series`: 4338ms\n* `fastseries` with results: 4096ms\n\nThese benchmarks where taken on node v4.2.2, on a MacBook\nPro Retina Mid 2014 (i7, 16GB of RAM).\n\n-------------------------------------------------------\n<a name=\"waterfall\"></a>\n### steed.waterfall(tasks[, done(err, ...)])\n\nRuns the functions in `tasks` in series, each passing their result to\nthe next task in the array. Quits early if any of the tasks errors.\n\nUses [fastfall](http://npm.im/fastfall).\n\nExample:\n\n```js\nvar steed = require('steed')()\n// or\n// var steed = require('steed')\n\nsteed.waterfall([\n  function a (cb) {\n    console.log('called a')\n    cb(null, 'a')\n  },\n  function b (a, cb) {\n    console.log('called b with:', a)\n    cb(null, 'a', 'b')\n  },\n  function c (a, b, cb) {\n    console.log('called c with:', a, b)\n    cb(null, 'a', 'b', 'c')\n  }], function result (err, a, b, c) {\n    console.log('result arguments', arguments)\n  })\n\n// preferred version for maximum speed\nfunction run (word, cb) {\n  steed.waterfall(new State(cb), [\n    aT, bT, cT,\n  ], cb)\n}\n\n// can be optimized by V8 using an hidden class\nfunction State (value) {\n  this.value = value\n}\n\n// because it is not a closure inside run()\n// v8 can optimize this function\nfunction aT (cb) {\n  console.log(this.value)\n  console.log('called a')\n  cb(null, 'a')\n}\n\n// because it is not a closure inside run()\n// v8 can optimize this function\nfunction bT (a, cb) {\n  console.log('called b with:', a)\n  cb(null, 'a', 'b')\n}\n\n// because it is not a closure inside run()\n// v8 can optimize this function\nfunction cT (a, b, cb) {\n  console.log('called c with:', a, b)\n  cb(null, 'a', 'b', 'c')\n}\n```\n\nBenchmark for doing 3 calls `setImmediate` 100 thousands times:\n\n* non-reusable setImmediate: 418ms\n* `async.waterfall`: 1174ms\n* `run-waterfall`: 1432ms\n* `insync.wasterfall`: 1174ms\n* `neo-async.wasterfall`: 469ms\n* `waterfallize`: 749ms\n* `fastfall`: 452ms\n\nThese benchmarks where taken on node v4.2.2, on a MacBook\nPro Retina Mid 2014 (i7, 16GB of RAM).\n\n-------------------------------------------------------\n<a name=\"each\"></a>\n### steed.each([that,] array, iterator(item, cb), [, done()])\n\nIterate over all elements of the given array asynchronosly and in\nparallel.\nCalls `iterator` with an item and a callback. Calls `done` when all have\nbeen processed.\n\nThe `that` argument will set `this` for each task and `done` callback.\n\n`each` does not handle errors, if you need errors, use [`map`](#map).\n\nUses [fastparallel](http://npm.im/fastparallel).\n\nExample:\n\n```js\nvar steed = require('steed')()\n// or\n// var steed = require('steed')\n\nvar input = [1, 2, 3]\nvar factor = 2\n\nsteed.each(input, function (num, cb) {\n  console.log(num * factor)\n  setImmediate(cb)\n}, function () {\n  console.log('done')\n})\n\n// preferred version for max speed\nfunction run (factor, args, cb) {\n  steed.each(new State(factor), work, cb)\n}\n\n// can be optimizied by V8 using an hidden class\nfunction State (factor) {\n  this.factor = factor\n}\n\n// because it is not a closure inside run()\n// v8 can optimize this function\nfunction work (num, cb) {\n  console.log(num * this.factor)\n  cb()\n}\n\nrun(factor, input, console.log)\n```\n\nBenchmark for doing 3 calls `setImmediate` 1 million times:\n\n* non-reusable `setImmediate`: 1781ms\n* `async.each`: 2621ms\n* `neoAsync.each`: 2156ms\n* `insync.parallel`: 10252ms\n* `insync.each`: 2397ms\n* `fastparallel` each: 1941ms\n\nThese benchmarks where taken on node v4.2.2, on a MacBook\nPro Retina Mid 2014 (i7, 16GB of RAM).\n\n-------------------------------------------------------\n<a name=\"eachSeries\"></a>\n### steed.eachSeries([that,] array, iterator(item, cb), [, done(err)])\n\nIterate over all elements of the given array asynchronously and in\nseries.\nCalls `iterator` with an item and a callback. Calls `done` when all have\nbeen processed.\n\nThe `that` argument will set `this` for each task and `done` callback.\n\n`eachSeries` does not handle errors, if you need errors, use [`mapSeries`](#mapSeries).\n\nUses [fastseries](http://npm.im/fastseries).\n\nExample:\n\n```js\nvar steed = require('steed')()\n// or\n// var steed = require('steed')\n\nvar input = [1, 2, 3]\nvar factor = 2\n\nsteed.eachSeries(input, function (num, cb) {\n  console.log(num * factor)\n  setImmediate(cb)\n}, function (err) {\n  console.log(err)\n})\n\n// preferred version for max speed\nfunction run (factor, args, cb) {\n  steed.eachSeries(new State(factor), work, cb)\n}\n\n// can be optimizied by V8 using an hidden class\nfunction State (factor) {\n  this.factor = factor\n}\n\n// because it is not a closure inside run()\n// v8 can optimize this function\nfunction work (num, cb) {\n  console.log(num * this.factor)\n  cb()\n}\n\nrun(factor, input, console.log)\n```\n\nBenchmark for doing 3 calls `setImmediate` 1 million times:\n\n* non-reusable `setImmediate`: 3887ms\n* `async.mapSeries`: 5540ms\n* `neoAsync.eachSeries`: 4195ms\n* `fastseries` each: 4168ms\n\nThese benchmarks where taken on node v4.2.2, on a MacBook\nPro Retina Mid 2014 (i7, 16GB of RAM).\n\n-------------------------------------------------------\n<a name=\"map\"></a>\n### steed.map([that,] array, iterator(item, cb), [, done(err, results)])\n\nPerforms a map operation over all elements of the given array asynchronously and in\nparallel. The result is an a array where all items have been replaced by\nthe result of `iterator`.\n\nThe `that` argument will set `this` for each task and `done` callback.\n\nCalls `iterator` with an item and a callback. Calls `done` when all have\nbeen processed.\n\nUses [fastparallel](http://npm.im/fastparallel).\n\nExample:\n\n```js\nvar steed = require('steed')()\n// or\n// var steed = require('steed')\n\nvar input = [1, 2, 3]\nvar factor = 2\n\nsteed.map(input, function (num, cb) {\n  setImmediate(cb, null, num * factor)\n}, function (err, results) {\n  if (err) { throw err }\n\n  console.log(results.reduce(sum))\n})\n\nfunction sum (acc, num) {\n  return acc + num\n}\n\n// preferred version for max speed\nfunction run (factor, args, cb) {\n  steed.map(new State(factor, cb), args, work, done)\n}\n\n// can be optimizied by V8 using an hidden class\nfunction State (factor, cb) {\n  this.factor = factor\n  this.cb = cb\n}\n\n// because it is not a closure inside run()\n// v8 can optimize this function\nfunction work (num, cb) {\n  setImmediate(cb, null, num * this.factor)\n}\n\nfunction done (err, results) {\n  results = results || []\n  this.cb(err, results.reduce(sum))\n}\n\nrun(2, [1, 2, 3], console.log)\n```\n\nBenchmark for doing 3 calls `setImmediate` 1 million times:\n\n* non-reusable `setImmediate`: 1781ms\n* `async.map`: 3054ms\n* `neoAsync.map`: 2080ms\n* `insync.map`: 9700ms\n* `fastparallel` map: 2102ms\n\nThese benchmarks where taken on node v4.2.2, on a MacBook\nPro Retina Mid 2014 (i7, 16GB of RAM).\n\n-------------------------------------------------------\n<a name=\"mapSeries\"></a>\n### steed.mapSeries([that,] array, iterator(item, cb), [, done(err, results)])\n\nPerforms a map operation over all elements of the given array asynchronosly and in\nseries. The result is an a array where all items have been replaced by\nthe result of `iterator`.\n\nCalls `iterator` with an item and a callback. Calls `done` when all have\nbeen processed.\n\nThe `that` argument will set `this` for each task and `done` callback.\n\nUses [fastseries](http://npm.im/fastseries).\n\nExample:\n\n```js\nvar steed = require('steed')()\n// or\n// var steed = require('steed')\n\nvar input = [1, 2, 3]\nvar factor = 2\n\nsteed.mapSeries(input, function (num, cb) {\n  setImmediate(cb, null, num * factor)\n}, function (err, results) {\n  if (err) { throw err }\n\n  console.log(results.reduce(sum))\n})\n\nfunction sum (acc, num) {\n  return acc + num\n}\n\n// preferred version for max speed\nfunction run (factor, args, cb) {\n  steed.mapSeries(new State(factor, cb), args, work, done)\n}\n\n// can be optimizied by V8 using an hidden class\nfunction State (factor, cb) {\n  this.factor = factor\n  this.cb = cb\n}\n\n// because it is not a closure inside run()\n// v8 can optimize this function\nfunction work (num, cb) {\n  setImmediate(cb, null, num * this.factor)\n}\n\nfunction done (err, results) {\n  results = results || []\n  this.cb(err, results.reduce(sum))\n}\n\nrun(2, [1, 2, 3], console.log)\n```\n\nBenchmark for doing 3 calls `setImmediate` 1 million times:\n\n* non-reusable `setImmediate`: 3887ms\n* `async.mapSeries`: 5540ms\n* `neoAsync.mapSeries`: 4237ms\n* `fastseries` map: 4032ms\n\nThese benchmarks where taken on node v4.2.2, on a MacBook\nPro Retina Mid 2014 (i7, 16GB of RAM).\n\n-------------------------------------------------------\n<a name=\"queue\"></a>\n### steed.queue(worker, concurrency)\n\nCreates a new queue. See [fastq](http://npm.im/fastq) for full API.\n\nArguments:\n\n* `worker`, worker function, it would be called with `that` as `this`,\n  if that is specified.\n* `concurrency`, number of concurrent tasks that could be executed in\n  parallel.\n\nExample:\n\n```js\nvar steed = require('steed')()\n// or\n// var steed = require('steed')\n\nvar queue = steed.queue(worker, 1)\n\nqueue.push(42, function (err, result) {\n  if (err) { throw err }\n  console.log('the result is', result)\n})\n\nfunction worker (arg, cb) {\n  cb(null, arg * 2)\n}\n```\n\nBenchmarks (1 million tasks):\n\n* setImmedidate: 1313ms\n* fastq: 1462ms\n* async.queue: 3989ms\n\nObtained on node 4.2.2, on a MacBook Pro 2014 (i7, 16GB of RAM).\n\n## Caveats\n\nThis library works by caching the latest used function, so that running a new parallel\ndoes not cause **any memory allocations**.\n\nThe `done` function will be called only once, even if more than one error happen.\n\n__Steed__ has no safety checks: you should be responsible to avoid sync\nfunctions and so on. Also arguments type checks are not included, so be\ncareful in what you pass.\n\n<a name=\"why\"></a>\n## Why it is so fast?\n\n1. This library is caching functions a lot. We invented a technique to\n   do so, and packaged it in a module: [reusify](http://npm.im/reusify).\n\n2. V8 optimizations: thanks to caching, the functions can be optimized by V8\n   (if they are optimizable, and we took great care of making them so).\n\n3. Don't use arrays if you just need a queue. A linked list implemented via\n   objects is much faster if you do not need to access elements in between.\n\n## Acknowledgements\n\nSteed is sponsored by [nearForm](http://nearform.com).\n\nThe steed logo was created, with thanks, by [Dean McDonnell](https://github.com/mcdonnelldean)\n\n## License\n\nMIT\n\n[logo-url]: https://raw.githubusercontent.com/mcollina/steed/master/assets/banner.png\n[npm-badge]: https://badge.fury.io/js/steed.svg\n[npm-url]: https://badge.fury.io/js/steed\n[travis-badge]: https://api.travis-ci.org/mcollina/steed.svg\n[travis-url]: https://travis-ci.org/mcollina/steed\n[coveralls-badge]:https://coveralls.io/repos/mcollina/steed/badge.svg?branch=master&service=github\n[coveralls-url]: https://coveralls.io/github/mcollina/steed?branch=master\n[david-badge]: https://david-dm.org/mcollina/steed.svg\n[david-url]: https://david-dm.org/mcollina/steed\n","maintainers":[{"name":"matteo.collina","email":"hello@matteocollina.com"}],"time":{"modified":"2022-06-27T00:17:28.501Z","created":"2015-11-04T09:39:06.260Z","0.0.1":"2015-11-04T09:39:06.260Z","1.0.0":"2015-11-23T09:29:02.895Z","1.0.1":"2015-11-23T09:45:58.714Z","1.0.2":"2015-11-23T15:20:58.133Z","1.1.0":"2015-11-24T08:17:27.692Z","1.1.1":"2015-11-24T08:49:39.117Z","1.1.2":"2015-12-11T08:18:14.734Z","1.1.3":"2016-03-18T15:46:57.512Z"},"homepage":"https://github.com/mcollina/steed#readme","keywords":["control","flow","async","series","parallel"],"repository":{"type":"git","url":"git+https://github.com/mcollina/steed.git"},"author":{"name":"Matteo Collina","email":"hello@matteocollina.com"},"bugs":{"url":"https://github.com/mcollina/steed/issues"},"license":"MIT","readmeFilename":"README.md","users":{"maxogden":true,"bret":true,"majgis":true,"ceejbot":true,"brandonpapworth":true,"hengkiardo":true,"henryorrin":true,"rexpan":true}}