{"_id":"foreachasync","_rev":"161882","name":"foreachasync","description":"A node- and browser-ready async (now with promises) counterpart of Array.prototype.forEach","dist-tags":{"latest":"5.1.3"},"maintainers":[{"name":"coolaj86","email":""}],"time":{"modified":"2021-06-03T11:41:13.000Z","created":"2014-01-22T19:47:04.311Z","5.1.3":"2019-04-05T18:54:50.283Z","5.1.2":"2018-03-28T05:52:42.452Z","5.0.5":"2015-01-07T07:57:59.033Z","5.0.4":"2015-01-06T06:24:33.399Z","3.0.0":"2014-01-22T19:47:04.311Z"},"users":{},"author":{"name":"AJ ONeal","email":"coolaj86@gmail.com","url":"https://coolaj86.com/"},"repository":{"type":"git","url":"https://git.coolaj86.com/coolaj86/foreachasync.js.git"},"versions":{"5.1.3":{"name":"foreachasync","version":"5.1.3","description":"A node- and browser-ready async (now with promises) counterpart of Array.prototype.forEach","homepage":"https://git.coolaj86.com/coolaj86/foreachasync.js","main":"foreachasync.js","directories":{"test":"test"},"scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"repository":{"type":"git","url":"https://git.coolaj86.com/coolaj86/foreachasync.js.git"},"keywords":["futuresjs","forEach","for","forEachAsync","async","futures","promise","promises","each"],"trulyOptionalDependencies":{"bluebird":"^3.5.1"},"author":{"name":"AJ ONeal","email":"coolaj86@gmail.com","url":"https://coolaj86.com/"},"license":"(MIT OR Apache-2.0)","bugs":{"url":"https://git.coolaj86.com/coolaj86/foreachasync.js/issues"},"dependencies":{},"gitHead":"e534d3a4b3e0f1e0c441dfedcf80a5894e897296","_id":"foreachasync@5.1.3","_npmVersion":"6.4.1","_nodeVersion":"10.13.0","_npmUser":{"name":"coolaj86","email":"coolaj86@gmail.com"},"dist":{"shasum":"b40ee0031bd3256b317c3197672a564d8d8c7ad4","size":6380,"noattachment":false,"key":"/foreachasync/-/foreachasync-5.1.3.tgz","tarball":"http://registry.cnpm.dingdandao.com/foreachasync/download/foreachasync-5.1.3.tgz"},"maintainers":[{"name":"coolaj86","email":""}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/foreachasync_5.1.3_1554490490007_0.45320862086837144"},"_hasShrinkwrap":false,"publish_time":1554490490283,"_cnpm_publish_time":1554490490283},"5.1.2":{"name":"foreachasync","version":"5.1.2","description":"A node- and browser-ready async (now with promises) counterpart of Array.prototype.forEach","homepage":"https://git.coolaj86.com/coolaj86/foreachasync.js","main":"foreachasync.js","directories":{"test":"test"},"scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"repository":{"type":"git","url":"git://git.coolaj86.com/coolaj86/foreachasync.js.git"},"keywords":["futuresjs","forEach","for","forEachAsync","async","futures","promise","promises","each"],"optionalDependencies":{"bluebird":"^3.5.1"},"author":{"name":"AJ ONeal","email":"coolaj86@gmail.com","url":"https://coolaj86.com/"},"license":"(MIT or Apache-2.0)","bugs":{"url":"https://git.coolaj86.com/coolaj86/foreachasync.js/issues"},"dependencies":{"bluebird":"^3.5.1"},"gitHead":"34d8d7bbc5601875913476ea935d2bada18adf9d","_id":"foreachasync@5.1.2","_npmVersion":"5.6.0","_nodeVersion":"8.9.4","_npmUser":{"name":"coolaj86","email":"coolaj86@gmail.com"},"dist":{"shasum":"4ba7c0610098831f96a4e421e9e30cbc74eb0408","size":7971,"noattachment":false,"key":"/foreachasync/-/foreachasync-5.1.2.tgz","tarball":"http://registry.cnpm.dingdandao.com/foreachasync/download/foreachasync-5.1.2.tgz"},"maintainers":[{"name":"coolaj86","email":""}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/foreachasync_5.1.2_1522216362409_0.14996650795361366"},"_hasShrinkwrap":false,"publish_time":1522216362452,"_cnpm_publish_time":1522216362452},"5.0.5":{"name":"foreachasync","version":"5.0.5","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":"ba81917d4f979b68ac06c7eab05d97fea252b32b","_id":"foreachasync@5.0.5","_shasum":"6524613ae08de21e6f40f224a4888fb3f607fe80","_from":".","_npmVersion":"2.0.0","_npmUser":{"name":"coolaj86","email":"coolaj86@gmail.com"},"maintainers":[{"name":"coolaj86","email":""}],"dist":{"shasum":"6524613ae08de21e6f40f224a4888fb3f607fe80","size":8752,"noattachment":false,"key":"/foreachasync/-/foreachasync-5.0.5.tgz","tarball":"http://registry.cnpm.dingdandao.com/foreachasync/download/foreachasync-5.0.5.tgz"},"publish_time":1420617479033,"_cnpm_publish_time":1420617479033,"_hasShrinkwrap":false},"5.0.4":{"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":""}],"dist":{"shasum":"2b5b9dfe3f55f2608196d3d9cf9701cdb537b49f","size":9588,"noattachment":false,"key":"/foreachasync/-/foreachasync-5.0.4.tgz","tarball":"http://registry.cnpm.dingdandao.com/foreachasync/download/foreachasync-5.0.4.tgz"},"publish_time":1420525473399,"_cnpm_publish_time":1420525473399,"_hasShrinkwrap":false},"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"},"_id":"foreachasync@3.0.0","dist":{"shasum":"5502987dc8714be3392097f32e0071c9dee07cf6","size":6304,"noattachment":false,"key":"/foreachasync/-/foreachasync-3.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/foreachasync/download/foreachasync-3.0.0.tgz"},"_from":"./","_npmVersion":"1.3.22","_npmUser":{"name":"coolaj86","email":"coolaj86@gmail.com"},"maintainers":[{"name":"coolaj86","email":""}],"publish_time":1390420024311,"_cnpm_publish_time":1390420024311,"_hasShrinkwrap":false}},"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","_attachments":{},"homepage":"https://git.coolaj86.com/coolaj86/foreachasync.js","bugs":{"url":"https://git.coolaj86.com/coolaj86/foreachasync.js/issues"},"license":"(MIT OR Apache-2.0)"}