{"_id":"forEachAsync","_rev":"27-de286ecf6f385bdd4307286f58d21a92","name":"forEachAsync","description":"A node- and browser-ready async counterpart of Array.prototype.forEach","dist-tags":{"latest":"3.0.0","beta":"3.0.0-rc1"},"versions":{"2.1.1":{"name":"forEachAsync","version":"2.1.1","description":"The forEachAsync module of FuturesJS (Ender.JS and Node.JS)","homepage":"https://github.com/coolaj86/futures","keywords":["flow-control","async","asynchronous","futures","forEachAsync","chain","step","util","browser"],"repository":{"type":"git","url":"git://github.com/coolaj86/futures.git"},"author":{"name":"AJ ONeal","email":"coolaj86@gmail.com","url":"http://coolaj86.info"},"main":"forEachAsync.js","directories":{"lib":"."},"dependencies":{"sequence":">= 2.1.1"},"engines":{"node":"*","ender":">= 0.5.0"},"_npmJsonOpts":{"file":"/Users/coolaj86/.npm/forEachAsync/2.1.1/package/package.json","wscript":false,"contributors":false,"serverjs":false},"_id":"forEachAsync@2.1.1","devDependencies":{},"_engineSupported":true,"_npmVersion":"1.0.15","_nodeVersion":"v0.4.8","_defaultsLoaded":true,"dist":{"shasum":"b0512c32d81a77a17463ffb735b4e38f173580b2","tarball":"https://registry.npmjs.org/forEachAsync/-/forEachAsync-2.1.1.tgz","integrity":"sha512-rrP9nhfkFn+QO8iqLPrLVvTfWYW6FVnkKKQjBSAbW61nIRKJUhCWOEc4/ZEBXmLV0y5gA6q0U2WyTKvZL1qqJw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQClxfXrc/UV/5QV/GUSHzTFm0DjXILQ07D1BQLDkKeEfwIgT+6/7d0sQB4jZtKrFLutTgN9J9UCBRKA/L1jD8BEgSE="}]},"scripts":{},"deprecated":"Please use 'foreachasync' instead. See https://www.npmjs.com/package/foreachasync"},"2.2.0":{"name":"forEachAsync","version":"2.2.0","description":"The forEachAsync module of FuturesJS (Ender.JS and Node.JS)","homepage":"https://github.com/coolaj86/futures","keywords":["flow-control","async","asynchronous","futures","forEachAsync","chain","step","util","browser"],"repository":{"type":"git","url":"git://github.com/coolaj86/futures.git"},"author":{"name":"AJ ONeal","email":"coolaj86@gmail.com","url":"http://coolaj86.info"},"main":"forEachAsync.js","directories":{"lib":"."},"dependencies":{"sequence":">= 2.2.1"},"engines":{"node":"*","ender":">= 0.5.0"},"_npmUser":{"name":"coolaj86","email":"coolaj86@gmail.com"},"_id":"forEachAsync@2.2.0","devDependencies":{},"optionalDependencies":{},"_engineSupported":true,"_npmVersion":"1.1.24","_nodeVersion":"v0.6.19","_defaultsLoaded":true,"dist":{"shasum":"093b32ce868cb69f5166dcf331fae074adc71cee","tarball":"https://registry.npmjs.org/forEachAsync/-/forEachAsync-2.2.0.tgz","integrity":"sha512-0Bc//6Hz+K/Wx+wc7bDTm5QluoTT1wi6hO3sE+EvNhyplz3IZmIa23z6AzAVgz+5Q0gXQNqAkJePa/kN0BVFNQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIBabfdnDQ0G9J1W5s8uXIttOysWfbbsrZFdcJN2xWzr8AiA/xW+UPgSgN9FjS8LuDV1a4GNBBel0QGyEYqnpoNkgcg=="}]},"readme":"Array.forEachAsync()\n----\n\nAnother reincarnation of `sequence` that makes sense for the use case of arrays.\n\n**Example:**\n\n    var forEachAsync = require('forEachAsync')\n      , count = 0\n      , timers = [\n          101,\n          502,\n          203,\n          604,\n          105\n        ];\n\n    function hello(next, time) {\n      this[count] = time;\n\n      if (count >= 4) {\n        next(forEachAsync.BREAK);\n      }\n\n      console.log(count += 1, time);\n\n      setTimeout(next, time);\n    }\n\n    function goodbye() {\n      console.log(\"All Done\", this);\n    }\n\n    forEachAsync(timers, hello, {}).then(goodbye);\n\nAPI\n---\n\n  * forEachAsync(array, callback*[, thisArg]*)\n  * forEachAsync#then(finalCallback)\n  * forEachAsync#BREAK\n\n**Warning:** [Poorly written code](https://gist.github.com/941362) may have really strange errors when `Array.prototype` is extended.\nIf you run into such problems please contact the author of the code (I'm also willing to help if they are unavailable).\nLibraries such as `jQuery` or `MooTools` will accept bug reports for such failures.\n\n","maintainers":[{"name":"coolaj86","email":"coolaj86@gmail.com"}],"deprecated":"Please use 'foreachasync' instead. See https://www.npmjs.com/package/foreachasync"},"3.0.0-rc1":{"name":"forEachAsync","version":"3.0.0-rc1","description":"A node- and browser-ready async counterpart of Array.prototype.forEach","main":"forEachAsync.js","directories":{"test":"test"},"scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"repository":{"type":"git","url":"git://github.com/FuturesJS/forEachAsync.git"},"keywords":["forEach","for","forEachAsync","async","futures","futuresjs","each"],"author":{"name":"AJ ONeal","email":"coolaj86@gmail.com","url":"http://coolaj86.info/"},"license":"Apache2","bugs":{"url":"https://github.com/FuturesJS/forEachAsync/issues"},"readme":"forEachAsync\n===\n\nAs I do every few years, I decided to rewrite FuturesJS.\nThis year's remake is extremely lightweight.\n\nv3.x - Diet Cola Edition\n(published on npm as beta, so you must use the @3.x - and don't worry, v2.x is still supported)\n\nAnalogous to `[].forEach`, but handles items asynchronously with a final callback passed to `then`.\n\nThis is the most essential piece of the [`ArrayAsync`](https://github.com/FuturesJS/ArrayAsync) package.\n\nUsage\n===\n\nIt's as simple as you could guess:\n\n```javascript\n  // an asynchronous web request\n  function getPics(animal, cb) {\n    var flickerAPI = \"http://api.flickr.com/services/feeds/photos_public.gne?jsoncallback=?\";\n    $.getJSON(\n      flickerAPI\n    , { tags: thing\n      , tagmode: \"any\"\n      , format: \"json\"\n      , success: function (data) {\n          console.log('teh animals:', data);\n        }\n      , complete: cb\n      }\n    );\n  }\n\n  // waits for one request to finish before beginning the next\n  forEachAsync(['dogs', 'cats', 'octocats'], function (next, element, index, array) {\n    getPics(element, next);\n  \n  // then after all of the elements have been handled\n  // the final callback fires to let you know it's all done\n  }).then(function () {\n    console.log('All requests have finished');\n  });\n```\n\n\nBrowser Installation\n===\n\nYou can download and include `forEachAsync.js`:\n\n```html\n<script src=\"https://raw.github.com/FuturesJS/forEachAsync/master/forEachAsync.js\"></script>\n```\n\n```javascript\n(function () {\n  'use strict';\n\n  var forEachAsync = window.forEachAsync\n    ;\n\n  // do stuff ...\n}());\n```\n\nOr you can build it alongside other libraries:\n\n```bash\nnpm install -g pakmanager\nnpm install forEachAsync@3.x --save\npakmanager -e browser build\n```\n\n```html\n<script src=\"pakmanaged.js\"></script>\n```\n\n```javascript\n(function () {\n  'use strict';\n\n  var forEachAsync = require('forEachAsync').forEachAsync\n    ;\n\n  // do stuff ...\n}());\n```\n\n\nNode Installation\n===\n\n```bash\nnpm install --save forEachAsync@3.x\n```\n\nAPI\n===\n\n**`forEachAsync(array, callback[, thisArg])`**\n\nParameters\n\n  * `array` Array of elements to iterate over\n  * `callback` Function to execute for each element, takes 4 arguments\n    * `next` the function to call when the current element has been dealt with\n    * `element` a single element of the aforementioned array\n    * `index` the index of the current element\n    * `array` the same array mentioned above\n  * `thisArg` Object to use as `this` when executing `callback`\n\n**`forEachAsync#then(done)`**\n\nParameters\n\n  * `then` is in the return value of `forEachAsync` and accepts a final `done` callback.\n    * `done` called after `forEachAsync` is complete, takes no arguments\n\nInternal API\n===\n\n`forEachAsync.__BREAK`\n\nThis is used internally for the purposes of the `ArrayAsync` library.\n\nPlease don't `break` stuff; use `someAsync` or `everyAsync` instead.\n","readmeFilename":"README.md","_id":"forEachAsync@3.0.0-rc1","dist":{"shasum":"57107c6c9d0b8674b072a51090a030628c464753","tarball":"https://registry.npmjs.org/forEachAsync/-/forEachAsync-3.0.0-rc1.tgz","integrity":"sha512-vzH9a7PNXsrOKf/lQ/3GfO0KWf/7rxYLA9gzdjcQx+AaS1U8ApJzCLqGgmOjR6X2bk7bbbSHzsdDv0iYfaVfig==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDST23s0WQMBHYFsGSt8V2S9VzW43j9ea6K2gBjP99SwwIgaOkzCRPXmMJnAyNw8rU2nDSkrC/2Zv1FeWElAsbTZOs="}]},"_from":"./","_npmVersion":"1.2.32","_npmUser":{"name":"coolaj86","email":"coolaj86@gmail.com"},"maintainers":[{"name":"coolaj86","email":"coolaj86@gmail.com"}]},"2.2.1":{"name":"forEachAsync","version":"2.2.1","description":"The forEachAsync module of FuturesJS (Ender.JS and Node.JS)","homepage":"https://github.com/coolaj86/futures","keywords":["flow-control","async","asynchronous","futures","forEachAsync","chain","step","util","browser"],"repository":{"type":"git","url":"git://github.com/coolaj86/futures.git"},"author":{"name":"AJ ONeal","email":"coolaj86@gmail.com","url":"http://coolaj86.info"},"main":"forEachAsync.js","directories":{"lib":"."},"dependencies":{"sequence":"2.x"},"engines":{"node":"*","ender":">= 0.5.0"},"readme":"forEachAsync v3.x\n===\n\n**New Version** in a [new repo - FuturesJS/forEachAsync](https://github.com/FuturesJS/forEachAsync)\n\nv3.x (aka 'Diet Cola\") has all of the awesomeness of forEachAsync v2.x, but trims the fat and comes browser-ready!\n\nArray.forEachAsync()\n----\n\nAnother reincarnation of `sequence` that makes sense for the use case of arrays.\n\n**Example:**\n\n    var forEachAsync = require('forEachAsync')\n      , count = 0\n      , timers = [\n          101,\n          502,\n          203,\n          604,\n          105\n        ];\n\n    function hello(next, time) {\n      this[count] = time;\n\n      if (count >= 4) {\n        next(forEachAsync.BREAK);\n      }\n\n      console.log(count += 1, time);\n\n      setTimeout(next, time);\n    }\n\n    function goodbye() {\n      console.log(\"All Done\", this);\n    }\n\n    forEachAsync(timers, hello, {}).then(goodbye);\n\nAPI\n---\n\n  * forEachAsync(array, callback*[, thisArg]*)\n  * forEachAsync#then(finalCallback)\n  * forEachAsync#BREAK\n\n**Warning:** [Poorly written code](https://gist.github.com/941362) may have really strange errors when `Array.prototype` is extended.\nIf you run into such problems please contact the author of the code (I'm also willing to help if they are unavailable).\nLibraries such as `jQuery` or `MooTools` will accept bug reports for such failures.\n\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/coolaj86/futures/issues"},"_id":"forEachAsync@2.2.1","dist":{"shasum":"e3723f00903910e1eb4b1db3ad51b5c64a319fec","tarball":"https://registry.npmjs.org/forEachAsync/-/forEachAsync-2.2.1.tgz","integrity":"sha512-467afhqYkLqbcPcn7FWYetAhMjhni8J59KfSUmsIatdp17l3yzUpod42kGPcDULRyEciQjmeFEjQDMU4USF7uA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIDWjVdlzNyRBUO5n1VfyfhzAq02gxSQzc78y/aHuQxYrAiBx6AAs1zKEarxvxFpdbi+GvmTPvvV0vrDddKE8/MbCpQ=="}]},"_from":"./","_npmVersion":"1.3.11","_npmUser":{"name":"coolaj86","email":"coolaj86@gmail.com"},"maintainers":[{"name":"coolaj86","email":"coolaj86@gmail.com"}],"deprecated":"Please use 'foreachasync' instead. See https://www.npmjs.com/package/foreachasync"},"3.0.0":{"name":"forEachAsync","version":"3.0.0","description":"A node- and browser-ready async counterpart of Array.prototype.forEach","homepage":"https://github.com/FuturesJS/forEachAsync","main":"forEachAsync.js","directories":{"test":"test"},"scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"repository":{"type":"git","url":"git://github.com/FuturesJS/forEachAsync.git"},"keywords":["futuresjs","forEach","for","forEachAsync","async","futures","each"],"author":{"name":"AJ ONeal","email":"coolaj86@gmail.com","url":"http://coolaj86.com/"},"license":"Apache2","bugs":{"url":"https://github.com/FuturesJS/forEachAsync/issues"},"readme":"forEachAsync\n===\n\nAs I do every few years, I decided to rewrite FuturesJS.\nThis year's remake is extremely lightweight.\n\nv3.x - Diet Cola Edition\n(published on npm as beta, so you must use the @3.x - and don't worry, v2.x is still supported)\n\nAnalogous to `[].forEach`, but handles items asynchronously with a final callback passed to `then`.\n\nThis is the most essential piece of the [`ArrayAsync`](https://github.com/FuturesJS/ArrayAsync) package.\n\nUsage\n===\n\nIt's as simple as you could guess:\n\n```javascript\n  // waits for one request to finish before beginning the next\n  forEachAsync(['dogs', 'cats', 'octocats'], function (next, element, index, array) {\n    getPics(element, next);\n  \n  // then after all of the elements have been handled\n  // the final callback fires to let you know it's all done\n  }).then(function () {\n    console.log('All requests have finished');\n  });\n\n  // where `getPics` might be an asynchronous web request such as this\n  function getPics(animal, cb) {\n    var flickerAPI = \"http://api.flickr.com/services/feeds/photos_public.gne?jsoncallback=?\";\n    $.getJSON(\n      flickerAPI\n    , { tags: thing\n      , tagmode: \"any\"\n      , format: \"json\"\n      , success: function (data) {\n          console.log('teh animals:', data);\n        }\n      , complete: cb\n      }\n    );\n  }\n```\n\n\nBrowser Installation\n===\n\nYou can install from bower:\n\n```bash\nbower install forEachAsync\n```\n\nOr download the raw file from <https://raw.github.com/FuturesJS/forEachAsync/master/forEachAsync.js>:\n\n```bash\nwget https://raw.github.com/FuturesJS/forEachAsync/master/forEachAsync.js\n```\n\n```javascript\n(function () {\n  'use strict';\n\n  var forEachAsync = window.forEachAsync\n    ;\n\n  // do stuff ...\n}());\n```\n\nOr you can build it alongside other libraries:\n\n```bash\nnpm install -g pakmanager\nnpm install forEachAsync --save\npakmanager -e browser build\n```\n\n```html\n<script src=\"pakmanaged.js\"></script>\n```\n\n```javascript\n(function () {\n  'use strict';\n\n  var forEachAsync = require('forEachAsync').forEachAsync\n    ;\n\n  // do stuff ...\n}());\n```\n\n\nNode Installation\n===\n\n```bash\nnpm install --save forEachAsync@3.x\n```\n\nAPI\n===\n\n**`forEachAsync(array, callback[, thisArg])`**\n\nParameters\n\n  * `array` Array of elements to iterate over\n  * `callback` Function to execute for each element, takes 4 arguments\n    * `next` the function to call when the current element has been dealt with\n    * `element` a single element of the aforementioned array\n    * `index` the index of the current element\n    * `array` the same array mentioned above\n  * `thisArg` Object to use as `this` when executing `callback`\n\n**`forEachAsync#then(done)`**\n\nParameters\n\n  * `then` is in the return value of `forEachAsync` and accepts a final `done` callback.\n    * `done` called after `forEachAsync` is complete, takes no arguments\n\nInternal API\n===\n\n`forEachAsync.__BREAK`\n\nThis is used internally for the purposes of the `ArrayAsync` library.\n\nPlease don't `break` stuff; use `someAsync` or `everyAsync` instead.\n","readmeFilename":"README.md","_id":"forEachAsync@3.0.0","dist":{"shasum":"3475a95a77e4dc2d2800913e6824de77b00cd80a","tarball":"https://registry.npmjs.org/forEachAsync/-/forEachAsync-3.0.0.tgz","integrity":"sha512-a6qFIJll2VuqpWNRvJfgT7pGgobR89qnARafcCkGg6q1BCWrowc3WvRoYidxtFWRwaeUpk+5kiKZtdlRLwSufQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIBCL7EndRIlbTFoBi3xsTQpOtW7vtQQMjNdTJZYSuPS6AiEAtFH8Xi0ykH4KyQ8fuxQBcX7A3Hb8qESiLQnMpysuP10="}]},"_from":"./","_npmVersion":"1.3.11","_npmUser":{"name":"coolaj86","email":"coolaj86@gmail.com"},"maintainers":[{"name":"coolaj86","email":"coolaj86@gmail.com"}],"deprecated":"Please use 'foreachasync' instead. See https://www.npmjs.com/package/foreachasync"}},"maintainers":[{"name":"coolaj86","email":"coolaj86@gmail.com"}],"time":{"modified":"2022-06-18T02:54:21.797Z","created":"2011-07-13T20:39:18.056Z","2.1.1":"2011-07-13T20:39:18.499Z","2.2.0":"2012-07-03T21:42:00.443Z","3.0.0-rc1":"2013-08-06T19:20:23.405Z","3.0.0":"2014-01-13T23:07:22.204Z","2.2.1":"2014-01-13T18:17:22.976Z"},"author":{"name":"AJ ONeal","email":"coolaj86@gmail.com","url":"http://coolaj86.com/"},"repository":{"type":"git","url":"git://github.com/FuturesJS/forEachAsync.git"},"users":{"luiscape":true}}