{"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":"http://registry-npm.ywwl.com/forEachAsync/download/forEachAsync-3.0.0-rc1.tgz","integrity":"sha512-vzH9a7PNXsrOKf/lQ/3GfO0KWf/7rxYLA9gzdjcQx+AaS1U8ApJzCLqGgmOjR6X2bk7bbbSHzsdDv0iYfaVfig==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDST23s0WQMBHYFsGSt8V2S9VzW43j9ea6K2gBjP99SwwIgaOkzCRPXmMJnAyNw8rU2nDSkrC/2Zv1FeWElAsbTZOs="}],"size":6131,"noattachment":false,"key":"/forEachAsync/-/forEachAsync-3.0.0-rc1.tgz"},"_from":"./","_npmVersion":"1.2.32","_npmUser":{"name":"coolaj86","email":"coolaj86@gmail.com"},"maintainers":[{"name":"coolaj86","email":"coolaj86@gmail.com"}],"publish_time":1375816823405,"_cnpm_publish_time":1375816823405,"dist-tags":{"beta":"3.0.0-rc1","latest":"3.0.0"}}