chain-tinyにparallel追加
https://github.com/hokaccha/node-chain-tiny
配列かハッシュを受け取って並列に処理して全部終わったら次に進む。nextに渡したのがresultsで受け取れる。まあ普通です。
var r = []; chain.parallel({ foo: function(next) { setTimeout(function() { r.push(1); next(null, 1); }, 100); }, bar: function(next) { setTimeout(function() { r.push(2); next(null, 2); }, 1) } }) .end(function(err, results) { console.log(results); // => { foo: 1, bar: 2 } console.log(r); // => [2, 1] });
forEachParallelってのが名前長くて微妙だけどかっこいいのが思いつかん。