{"name":"foreachasync","version":"5.0.4","description":"A node- and browser-ready async (now with promises) 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","promise","promises","each"],"optionalDependencies":{"bluebird":"^2.5.3"},"author":{"name":"AJ ONeal","email":"coolaj86@gmail.com","url":"http://coolaj86.com/"},"license":"Apache2","bugs":{"url":"https://github.com/FuturesJS/forEachAsync/issues"},"dependencies":{"bluebird":"^2.5.3"},"gitHead":"7218a5348757526dc43647219d7433324e7ec65e","_id":"foreachasync@5.0.4","_shasum":"2b5b9dfe3f55f2608196d3d9cf9701cdb537b49f","_from":".","_npmVersion":"2.0.0","_npmUser":{"name":"coolaj86","email":"coolaj86@gmail.com"},"maintainers":[{"name":"coolaj86","email":"coolaj86@gmail.com"}],"dist":{"shasum":"2b5b9dfe3f55f2608196d3d9cf9701cdb537b49f","tarball":"http://registry-npm.ywwl.com/foreachasync/download/foreachasync-5.0.4.tgz","integrity":"sha512-fF0g15MmYl74O/Wu+ka5Fg2Qu7tkLkt213+pHWppvLnPYodQd7iU31V52OrwSxFUKAqQYxuJEJ6lUdQWYYky/w==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEMCIHgEb+FHcZuOf92ozImu1NBjIVOt2/k7kYc5DywzJUj0Ah8qubd0sycX7gBqsaALbpTrqWP6lujF+EyA/lcc0YlY"}],"size":9588,"noattachment":false,"key":"/foreachasync/-/foreachasync-5.0.4.tgz"},"readme":"forEachAsync.js\n===\n\n| A [Root](https://rootprojects.org) project\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\nFor cases where you want to loop through batches of items at once (as opposed to strictly one-by-one as forEachAsync does), check out [`forAllAsync`](https://github.com/FuturesJS/forAllAsync) and [`lateral`](https://github.com/FuturesJS/lateral).\n\nFor cases where you want to loop through all items at once and we able to know when they're all done see [`join`](https://github.com/FuturesJS/join)\n\nv5.x\n----\n\nWe jumped from 3.x to 5.x because I'm considering creating a backwards-and-forwards compatible 4.x that\nuses AngularJS-style function introspection to allow for having the next param.\nStraight up, that's probably a bad idea and waste of time so I hope I don't actually do it.\n\nScreencast\n---\n\n<https://youtu.be/O7egvEz4scA>\n\nUsage\n-----\n\n```javascript\n  // EXAMPLE ASYNC FUNCTION\n\n  function getPicsAsync(animal) {\n    var flickerApi = \"http://api.flickr.com/services/feeds/photos_public.gne?tagmode=any&format=json&tags=\" + animal;\n\n    return requestAsync({ url: flickerApi });\n  }\n```\n\n```javascript\n  forEachAsync(['dogs', 'cats', 'octocats'], function (element) {\n    return getPicsAsync(element);\n  }).then(function () {\n    // then after all of the elements have been handled\n    // the final callback fires to let you know it's all done\n    console.log('All requests have finished');\n  });\n```\n\n### Supplying your own Promises Implementation\n\nIf native ES6 promises are not available, then you should supply your own Promises/A+\nimplementation like so:\n\n```javascript\n  forEachAsync = forEachAsync.create(window.Promise || require('bluebird'));\n```\n\nBrowser Installation\n===\n\nYou can install from bower:\n\n```bash\nbower install --save forEachAsync@5.x\n```\n\nOr download the raw file from <https://git.coolaj86.com/coolaj86/foreachasync.js/raw/branch/master/foreachasync.js>:\n\n```bash\nwget https://git.coolaj86.com/coolaj86/foreachasync.js/raw/branch/master/foreachasync.js\n```\n\n```javascript\n(function () {\n  'use strict';\n\n  var forEachAsync = window.forEachAsync;\n\n  // do stuff ...\n}());\n```\n\n**Note**: If you need both 3.x/4.x and 5.x version of `forEachAsync` in the browser... good luck with that...\n\nNode Installation\n===\n\n```bash\nnpm install --save foreachasync@5.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    * `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 [`ArrayAsync`](https://github.com/FuturesJS/ArrayAsync)`.someAsync` or [`ArrayAsync`](https://github.com/FuturesJS/ArrayAsync)`.everyAsync` instead.\n","publish_time":1420525473399,"_cnpm_publish_time":1420525473399,"dist-tags":{"latest":"5.1.3"}}