{"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":{"integrity":"sha512-801fq36drEil6qqAp5CJnXKl+0NtBL4uU1Rw9wSp6ajjLgLty9pTV90D9Xpm1ToEVOKJzrfY7+np7KZyE0H5gA==","shasum":"4ba7c0610098831f96a4e421e9e30cbc74eb0408","tarball":"http://registry-npm.ywwl.com/foreachasync/download/foreachasync-5.1.2.tgz","fileCount":14,"unpackedSize":22099,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCMdusUKCm4uGi7i3Mfod6bAjaQbNZa29/ZLfYR7ut0pAIgf4cz2UnO+VwffZJD44WJGtjo3/BsGYcOQ7Gsy5ffIyY="}],"size":7971,"noattachment":false,"key":"/foreachasync/-/foreachasync-5.1.2.tgz"},"maintainers":[{"name":"coolaj86","email":"coolaj86@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/foreachasync_5.1.2_1522216362409_0.14996650795361366"},"_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","publish_time":1522216362452,"_cnpm_publish_time":1522216362452,"dist-tags":{"latest":"5.1.3"}}