{"_id":"chainy-plugin-each","_rev":"215204","name":"chainy-plugin-each","description":"Chainy action that iterates through each item in the array with an asynchronous or synchronous iterator","dist-tags":{"latest":"1.1.0"},"maintainers":[{"name":"balupton","email":"b@lupton.cc"}],"time":{"modified":"2021-06-03T15:35:01.000Z","created":"2014-06-23T17:48:37.667Z","1.1.0":"2016-06-07T22:36:03.182Z","1.0.0":"2014-06-23T17:48:37.667Z"},"users":{},"author":{"name":"2014+ Bevry Pty Ltd","email":"us@bevry.me","url":"https://bevry.me"},"repository":{"type":"git","url":"git+ssh://git@github.com/chainyjs/each.git"},"versions":{"1.1.0":{"title":"Each action for ChainyJS","name":"chainy-plugin-each","version":"1.1.0","description":"Chainy action that iterates through each item in the array with an asynchronous or synchronous iterator","homepage":"https://github.com/chainyjs/each","license":"MIT","keywords":["chainy-action","chainy-iterator","chainy-standalone","chainy-plugin","chainy-extension","chainy-addon","chainy"],"badges":{"list":["travisci","npmversion","npmdownloads","daviddm","daviddmdev","---","slackin","patreon","gratipay","flattr","paypal","bitcoin","wishlist"],"config":{"patreonUsername":"bevry","gratipayUsername":"bevry","flattrUsername":"balupton","paypalURL":"https://bevry.me/paypal","bitcoinURL":"https://bevry.me/bitcoin","wishlistURL":"https://bevry.me/wishlist","slackinURL":"https://slack.bevry.me"}},"author":{"name":"2014+ Bevry Pty Ltd","email":"us@bevry.me","url":"https://bevry.me"},"maintainers":[{"name":"balupton","email":"b@lupton.cc"}],"contributors":[],"bugs":{"url":"https://github.com/chainyjs/each/issues"},"repository":{"type":"git","url":"git+ssh://git@github.com/chainyjs/each.git"},"editions":[{"description":"Source + ES5 + Require","entry":"source/index.js","directory":"source","syntaxes":["javascript","es5","require"]}],"main":"source/index.js","browser":"source/index.js","scripts":{"setup":"npm install","clean":"rm -Rf ./docs","compile":"echo 'no compile necessary'","meta":"npm run meta:projectz","meta:projectz":"projectz compile","prepare":"npm run test && npm run meta","release":"npm run prepare && npm run release:publish && npm run release:tag && npm run release:push","release:publish":"npm publish","release:tag":"git tag v$npm_package_version -a","release:push":"git push origin master && git push origin --tags","pretest":"npm run test:eslint","test:eslint":"eslint ./source","test":"node --harmony ./source/test.js"},"dependencies":{"taskgroup":"5"},"peerDependencies":{"chainy-core":"1"},"devDependencies":{"chainy-plugin-set":"*","chainy-core":"1","eslint":"^2.11.1","joe":"^1.8.0","joe-reporter-console":"^1.2.1","assert-helpers":"^4.4.0","projectz":"^1.1.5"},"gitHead":"d67d0966c2a78758d1273567d677fd8658472b3c","_id":"chainy-plugin-each@1.1.0","_shasum":"82524183a2e7fac7fba44fe8a71ce749aa5ccdc6","_from":".","_npmVersion":"3.9.5","_nodeVersion":"6.2.1","_npmUser":{"name":"balupton","email":"b@lupton.cc"},"dist":{"shasum":"82524183a2e7fac7fba44fe8a71ce749aa5ccdc6","size":4799,"noattachment":false,"key":"/chainy-plugin-each/-/chainy-plugin-each-1.1.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/chainy-plugin-each/download/chainy-plugin-each-1.1.0.tgz"},"_npmOperationalInternal":{"host":"packages-16-east.internal.npmjs.com","tmp":"tmp/chainy-plugin-each-1.1.0.tgz_1465338959835_0.5988940936513245"},"directories":{},"publish_time":1465338963182,"_cnpm_publish_time":1465338963182,"_hasShrinkwrap":false},"1.0.0":{"title":"Each action for [ChainyJS](http://chainyjs.org)","name":"chainy-plugin-each","version":"1.0.0","description":"Chainy action that iterates through each item in the array with an asynchronous or synchronous iterator","homepage":"https://github.com/chainy-plugins/each","keywords":["chainy-action","chainy-iterator","chainy-standalone","chainy-plugin","chainy-extension","chainy-addon","chainy"],"license":{"type":"MIT"},"badges":{"travis":true,"npm":true,"david":true,"daviddev":true,"gittip":"bevry","flattr":"344188/balupton-on-Flattr","paypal":"QB8GQPZAH84N6","bitcoin":"https://coinbase.com/checkouts/9ef59f5479eec1d97d63382c9ebcb93a","wishlist":"http://amzn.com/w/2F8TXKSNAFG4V"},"author":{"name":"2014+ Bevry Pty Ltd","email":"us@bevry.me","url":"http://bevry.me"},"maintainers":[{"name":"balupton","email":"b@lupton.cc"}],"contributors":[],"bugs":{"url":"https://github.com/chainy-plugins/each/issues"},"repository":{"type":"git","url":"http://github.com/chainy-plugins/each.git"},"engines":{"node":">=0.4"},"dependencies":{"taskgroup":"~4.0.0"},"peerDependencies":{"chainy-core":"1"},"devDependencies":{"chainy-plugin-set":"*","chainy-core":"1","joe":"~1.5.0","joe-reporter-console":"~1.2.1","chai":"~1.9.1","projectz":"~0.3.11"},"directories":{"test":"test"},"scripts":{"test":"node ./test/each-test.js"},"main":"./lib/each.js","browsers":true,"gitHead":"fcc320eba4fde221c3da679d9a391797e51e9bf7","_id":"chainy-plugin-each@1.0.0","_shasum":"3b07b3ca7dda5a82aa395a634cf0caa39b9a14ac","_from":".","_npmVersion":"1.4.16","_npmUser":{"name":"balupton","email":"b@lupton.cc"},"dist":{"shasum":"3b07b3ca7dda5a82aa395a634cf0caa39b9a14ac","size":3945,"noattachment":false,"key":"/chainy-plugin-each/-/chainy-plugin-each-1.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/chainy-plugin-each/download/chainy-plugin-each-1.0.0.tgz"},"publish_time":1403545717667,"_cnpm_publish_time":1403545717667,"_hasShrinkwrap":false}},"readme":"<!-- TITLE/ -->\n\n<h1>Each action for ChainyJS</h1>\n\n<!-- /TITLE -->\n\n\n<!-- BADGES/ -->\n\n<span class=\"badge-travisci\"><a href=\"http://travis-ci.org/chainyjs/each\" title=\"Check this project's build status on TravisCI\"><img src=\"https://img.shields.io/travis/chainyjs/each/master.svg\" alt=\"Travis CI Build Status\" /></a></span>\n<span class=\"badge-npmversion\"><a href=\"https://npmjs.org/package/chainy-plugin-each\" title=\"View this project on NPM\"><img src=\"https://img.shields.io/npm/v/chainy-plugin-each.svg\" alt=\"NPM version\" /></a></span>\n<span class=\"badge-npmdownloads\"><a href=\"https://npmjs.org/package/chainy-plugin-each\" title=\"View this project on NPM\"><img src=\"https://img.shields.io/npm/dm/chainy-plugin-each.svg\" alt=\"NPM downloads\" /></a></span>\n<span class=\"badge-daviddm\"><a href=\"https://david-dm.org/chainyjs/each\" title=\"View the status of this project's dependencies on DavidDM\"><img src=\"https://img.shields.io/david/chainyjs/each.svg\" alt=\"Dependency Status\" /></a></span>\n<span class=\"badge-daviddmdev\"><a href=\"https://david-dm.org/chainyjs/each#info=devDependencies\" title=\"View the status of this project's development dependencies on DavidDM\"><img src=\"https://img.shields.io/david/dev/chainyjs/each.svg\" alt=\"Dev Dependency Status\" /></a></span>\n<br class=\"badge-separator\" />\n<span class=\"badge-slackin\"><a href=\"https://slack.bevry.me\" title=\"Join this project's slack community\"><img src=\"https://slack.bevry.me/badge.svg\" alt=\"Slack community badge\" /></a></span>\n<span class=\"badge-patreon\"><a href=\"http://patreon.com/bevry\" title=\"Donate to this project using Patreon\"><img src=\"https://img.shields.io/badge/patreon-donate-yellow.svg\" alt=\"Patreon donate button\" /></a></span>\n<span class=\"badge-gratipay\"><a href=\"https://www.gratipay.com/bevry\" title=\"Donate weekly to this project using Gratipay\"><img src=\"https://img.shields.io/badge/gratipay-donate-yellow.svg\" alt=\"Gratipay donate button\" /></a></span>\n<span class=\"badge-flattr\"><a href=\"https://flattr.com/profile/balupton\" title=\"Donate to this project using Flattr\"><img src=\"https://img.shields.io/badge/flattr-donate-yellow.svg\" alt=\"Flattr donate button\" /></a></span>\n<span class=\"badge-paypal\"><a href=\"https://bevry.me/paypal\" title=\"Donate to this project using Paypal\"><img src=\"https://img.shields.io/badge/paypal-donate-yellow.svg\" alt=\"PayPal donate button\" /></a></span>\n<span class=\"badge-bitcoin\"><a href=\"https://bevry.me/bitcoin\" title=\"Donate once-off to this project using Bitcoin\"><img src=\"https://img.shields.io/badge/bitcoin-donate-yellow.svg\" alt=\"Bitcoin donate button\" /></a></span>\n<span class=\"badge-wishlist\"><a href=\"https://bevry.me/wishlist\" title=\"Buy an item on our wishlist for us\"><img src=\"https://img.shields.io/badge/wishlist-donate-yellow.svg\" alt=\"Wishlist browse button\" /></a></span>\n\n<!-- /BADGES -->\n\n\n<!-- CHAINY_DOCUMENTATION/ -->\n\n<!-- DESCRIPTION/ -->\n\nChainy action that iterates through each item in the array with an asynchronous or synchronous iterator\n\n<!-- /DESCRIPTION -->\n\n\nUse the each plugin like so:\n\n``` javascript\nrequire('chainy').create().require('set each')\n\t// Iterate over an array\n\t.set(['a', 'b', 'c'])\n\t.each(iterator)\n\n\t// Iterate over an object\n\t.set({a: 1, b: 2, c: 3})\n\t.each(iterator)\n\n\t// Iterate with some custom options to use for the internal taskgroup\n\t.each(iterator, taskgroupOptions)\n```\n\nThe iterator can operate synchronously:\n\n``` javascript\n.each(function (itemValue) {\n\t// ..\n})\n```\n\nOr asynchronously:\n\n``` javascript\n.each(function (itemValue, complete) {\n\t// ...\n\tcomplete()\n})\n```\n\nOr asynchronously with the item's index/key as well:\n\n``` javascript\n.each(function (itemValue, itemIndex, complete) {\n\t// ...\n\tcomplete()\n})\n```\n\nThe `taskgroupOptions` is an optional configuration object that can be used to configure the internal [taskgroup](https://github.com/bevry/taskgroup). A common use case for this is to instead of having our iterators operate serially (one after the other, a concurrency of 1), instead we could have them all operate at once (with a concurrency of 0) by specifying the following taskgroup configuration like so:\n\n``` js\n.each(iterator, {concurrency: 0})\n```\n\nTying this all together, we can do things like:\n\n``` javascript\nrequire('chainy').create().require('set each')\n\n\t// --------------------------------\n\t// Array data\n\t.set(['a', 'b', 'c'])\n\n\t// Synchronous iterator\n\t.each(function (itemValue) {\n\t\tconsole.log(itemValue)  // 'a' then 'b' then 'c'\n\t})\n\n\t// Asynchronous iterator\n\t.each(function (itemValue, complete) {\n\t\tconsole.log(itemValue)  // 'a' then 'b' then 'c'\n\t\tcomplete()\n\t})\n\n\t// Asynchronous iterator with index\n\t.each(function (itemValue, itemIndex, complete) {\n\t\tconsole.log(itemValue)  // 'a' then 'b' then 'c'\n\t\tconsole.log(itemIndex)  // 0 then 1 then 2\n\t\tcomplete()\n\t})\n\n\n\t// --------------------------------\n\t// Object data\n\t.set({a:1, b:2, c:3})\n\n\t// Synchronous iterator\n\t.each(function (itemValue) {\n\t\tconsole.log(itemValue)  // 1 then 2 then 3\n\t})\n\n\t// Asynchronous iterator\n\t.each(function (itemValue, complete) {\n\t\tconsole.log(itemValue)  // 1 then 2 then 3\n\t\tcomplete()\n\t})\n\n\t// Asynchronous iterator with index\n\t.each(function (itemValue, itemIndex, complete) {\n\t\tconsole.log(itemValue)  // 1 then 2 then 3\n\t\tconsole.log(itemIndex)  // 'a' then 'b' then 'c'\n\t\tcomplete()\n\t})\n```\n\n<!-- /CHAINY_DOCUMENTATION -->\n\n\n<!-- INSTALL/ -->\n\n<h2>Install</h2>\n\n<a href=\"https://npmjs.com\" title=\"npm is a package manager for javascript\"><h3>NPM</h3></a><ul>\n<li>Install: <code>npm install --save chainy-plugin-each</code></li>\n<li>Module: <code>require('chainy-plugin-each')</code></li></ul>\n\n<a href=\"http://browserify.org\" title=\"Browserify lets you require('modules') in the browser by bundling up all of your dependencies\"><h3>Browserify</h3></a><ul>\n<li>Install: <code>npm install --save chainy-plugin-each</code></li>\n<li>Module: <code>require('chainy-plugin-each')</code></li>\n<li>CDN URL: <code>//wzrd.in/bundle/chainy-plugin-each@1.1.0</code></li></ul>\n\n<a href=\"http://enderjs.com\" title=\"Ender is a full featured package manager for your browser\"><h3>Ender</h3></a><ul>\n<li>Install: <code>ender add chainy-plugin-each</code></li>\n<li>Module: <code>require('chainy-plugin-each')</code></li></ul>\n\n<h3><a href=\"https://github.com/bevry/editions\" title=\"Editions are the best way to produce and consume packages you care about.\">Editions</a></h3>\n\n<p>This package is published with the following editions:</p>\n\n<ul><li><code>chainy-plugin-each</code> aliases <code>chainy-plugin-each/source/index.js</code></li>\n<li><code>chainy-plugin-each/source/index.js</code> is Source + ES5 + <a href=\"https://nodejs.org/dist/latest-v5.x/docs/api/modules.html\" title=\"Node/CJS Modules\">Require</a></li></ul>\n\n<!-- /INSTALL -->\n\n\n<!-- HISTORY/ -->\n\n<h2>History</h2>\n\n<a href=\"https://github.com/chainyjs/each/blob/master/HISTORY.md#files\">Discover the release history by heading on over to the <code>HISTORY.md</code> file.</a>\n\n<!-- /HISTORY -->\n\n\n<!-- CONTRIBUTE/ -->\n\n<h2>Contribute</h2>\n\n<a href=\"https://github.com/chainyjs/each/blob/master/CONTRIBUTING.md#files\">Discover how you can contribute by heading on over to the <code>CONTRIBUTING.md</code> file.</a>\n\n<!-- /CONTRIBUTE -->\n\n\n<!-- BACKERS/ -->\n\n<h2>Backers</h2>\n\n<h3>Maintainers</h3>\n\nThese amazing people are maintaining this project:\n\n<ul><li><a href=\"https://balupton.com\">Benjamin Lupton</a></li></ul>\n\n<h3>Sponsors</h3>\n\nNo sponsors yet! Will you be the first?\n\n<span class=\"badge-patreon\"><a href=\"http://patreon.com/bevry\" title=\"Donate to this project using Patreon\"><img src=\"https://img.shields.io/badge/patreon-donate-yellow.svg\" alt=\"Patreon donate button\" /></a></span>\n<span class=\"badge-gratipay\"><a href=\"https://www.gratipay.com/bevry\" title=\"Donate weekly to this project using Gratipay\"><img src=\"https://img.shields.io/badge/gratipay-donate-yellow.svg\" alt=\"Gratipay donate button\" /></a></span>\n<span class=\"badge-flattr\"><a href=\"https://flattr.com/profile/balupton\" title=\"Donate to this project using Flattr\"><img src=\"https://img.shields.io/badge/flattr-donate-yellow.svg\" alt=\"Flattr donate button\" /></a></span>\n<span class=\"badge-paypal\"><a href=\"https://bevry.me/paypal\" title=\"Donate to this project using Paypal\"><img src=\"https://img.shields.io/badge/paypal-donate-yellow.svg\" alt=\"PayPal donate button\" /></a></span>\n<span class=\"badge-bitcoin\"><a href=\"https://bevry.me/bitcoin\" title=\"Donate once-off to this project using Bitcoin\"><img src=\"https://img.shields.io/badge/bitcoin-donate-yellow.svg\" alt=\"Bitcoin donate button\" /></a></span>\n<span class=\"badge-wishlist\"><a href=\"https://bevry.me/wishlist\" title=\"Buy an item on our wishlist for us\"><img src=\"https://img.shields.io/badge/wishlist-donate-yellow.svg\" alt=\"Wishlist browse button\" /></a></span>\n\n<h3>Contributors</h3>\n\nNo contributors yet! Will you be the first?\n\n<a href=\"https://github.com/chainyjs/each/blob/master/CONTRIBUTING.md#files\">Discover how you can contribute by heading on over to the <code>CONTRIBUTING.md</code> file.</a>\n\n<!-- /BACKERS -->\n\n\n<!-- LICENSE/ -->\n\n<h2>License</h2>\n\nUnless stated otherwise all works are:\n\n<ul><li>Copyright &copy; 2014+ <a href=\"https://bevry.me\">Bevry Pty Ltd</a></li></ul>\n\nand licensed under:\n\n<ul><li><a href=\"http://spdx.org/licenses/MIT.html\">MIT License</a></li></ul>\n\n<!-- /LICENSE -->\n","_attachments":{},"homepage":"https://github.com/chainyjs/each","bugs":{"url":"https://github.com/chainyjs/each/issues"},"license":"MIT"}