{"name":"each-async","version":"0.1.1","description":"Async parallel iterator","license":"MIT","main":"each-async.js","repository":{"type":"git","url":"git://github.com/sindresorhus/each-async"},"author":{"name":"Sindre Sorhus","email":"sindresorhus@gmail.com","url":"http://sindresorhus.com"},"engines":{"node":">=0.8.0"},"scripts":{"test":"mocha"},"files":["each-async.js"],"keywords":["each","async","asynchronous","iteration","iterate","loop","foreach","parallel","concurrent","array","flow","control flow"],"devDependencies":{"mocha":"~1.14.0"},"bugs":{"url":"https://github.com/sindresorhus/each-async/issues"},"homepage":"https://github.com/sindresorhus/each-async","_id":"each-async@0.1.1","dist":{"shasum":"32bcef7e3cdc741d630e29846348be4ecca624ff","tarball":"http://registry-npm.ywwl.com/each-async/download/each-async-0.1.1.tgz","integrity":"sha512-QxdDlt3XHJ3R8wPgdNABx6rKHpVcZtQWghJZ/vMVyGBnU+1+Ei0GMHPoxfTJ418Hq9wZpXhUOeYHIIgi51e9dw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIBTJv9Y3QwU6nik7Uiu8j3CAjY0haB8As2lW6f+qk2idAiEA0B9NfHlqAmacmYKeiogQxNyD6KXmgJKft3upU493FTE="}],"size":1678,"noattachment":false,"key":"/each-async/-/each-async-0.1.1.tgz"},"_from":".","_npmVersion":"1.3.14","_npmUser":{"name":"sindresorhus","email":"sindresorhus@gmail.com"},"maintainers":[{"name":"sindresorhus","email":"sindresorhus@gmail.com"}],"directories":{},"readme":"# each-async\n\n> Async concurrent iterator (async forEach)\n\nLike [async.each()](https://github.com/caolan/async#eacharr-iterator-callback), but tiny.\n\nI often use `async.each()` for doing async operations when iterating, but I almost never use the other gadzillion methods in `async`.\n\nAsync iteration is one of the most used async control flow patterns.\n\n**I would strongly recommend using promises instead. You could then use the built-in [`Promise.all()`](https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/Promise/all), or [`p-map`](https://github.com/sindresorhus/p-map) if you need concurrency control.**\n\n\n## Install\n\n```\n$ npm install --save each-async\n```\n\n\n## Usage\n\n```js\nconst eachAsync = require('each-async');\n\neachAsync(['foo','bar','baz'], (item, index, done) => {\n\tconsole.log(item, index);\n\tdone();\n}, error => {\n\tconsole.log('finished');\n});\n//=> 'foo 0'\n//=> 'bar 1'\n//=> 'baz 2'\n//=> 'finished'\n```\n\n\n## API\n\n### eachAsync(input, callback, [finishedCallback])\n\n#### input\n\nType: `Array`\n\nArray you want to iterate.\n\n#### callback(item, index, done)\n\nType: `Function`\n\nCalled for each item in the array with the following arguments:\n\n- `item`: the current item in the array\n- `index`: the current index\n- `done([error])`: call this when you're done with an optional error. Supplying anything other than `undefined`/`null` will stop the iteration.\n\nNote that order is not guaranteed since each item is handled concurrently.\n\n#### finishedCallback(error)\n\nType: `Function`\n\nCalled when the iteration is finished or on the first error. First argument is the error passed from `done()` in the `callback`.\n\n\n## License\n\nMIT © [Sindre Sorhus](https://sindresorhus.com)\n","publish_time":1386384435261,"_cnpm_publish_time":1386384435261,"dist-tags":{"latest":"2.0.0"}}