{"name":"each-async","version":"1.1.1","description":"Async concurrent iterator (async forEach)","license":"MIT","repository":{"type":"git","url":"https://github.com/sindresorhus/each-async"},"author":{"name":"Sindre Sorhus","email":"sindresorhus@gmail.com","url":"http://sindresorhus.com"},"engines":{"node":">=0.10.0"},"scripts":{"test":"mocha --timeout 20000"},"files":["index.js"],"keywords":["each","async","asynchronous","iteration","iterate","loop","foreach","parallel","concurrent","array","flow","control flow"],"dependencies":{"onetime":"^1.0.0","set-immediate-shim":"^1.0.0"},"devDependencies":{"mocha":"*"},"gitHead":"65f7f663e0e1a323c11bd0e036a08f585ab34a9c","bugs":{"url":"https://github.com/sindresorhus/each-async/issues"},"homepage":"https://github.com/sindresorhus/each-async","_id":"each-async@1.1.1","_shasum":"dee5229bdf0ab6ba2012a395e1b869abf8813473","_from":".","_npmVersion":"2.1.16","_nodeVersion":"0.10.32","_npmUser":{"name":"sindresorhus","email":"sindresorhus@gmail.com"},"maintainers":[{"name":"sindresorhus","email":"sindresorhus@gmail.com"}],"dist":{"shasum":"dee5229bdf0ab6ba2012a395e1b869abf8813473","tarball":"http://registry-npm.ywwl.com/each-async/download/each-async-1.1.1.tgz","integrity":"sha512-0hJGub96skwr+sUojv7zQ0kc9i4jn3SwLiLk8Jr7KDz7aaaMzkN5UX3a/9ZhzC0OfZVyXHhlHcjC0KVOiKZ+HQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCgh1qed0/Mfxfu+ob0zt2lhEhViDS6Cir9dWr7OsgKvQIhAOV5G0244B/4xL0G1z4E4eEsIZTfufbZ/udQYEx4G32Y"}],"size":2222,"noattachment":false,"key":"/each-async/-/each-async-1.1.1.tgz"},"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":1419846308863,"_cnpm_publish_time":1419846308863,"dist-tags":{"latest":"2.0.0"}}