* Async array map using after
(ary, each, done)
| 5144 | */ |
| 5145 | |
| 5146 | function map(ary, each, done) { |
| 5147 | var result = new Array(ary.length); |
| 5148 | var next = after(ary.length, done); |
| 5149 | |
| 5150 | var eachWithIndex = function(i, el, cb) { |
| 5151 | each(el, function(error, msg) { |
| 5152 | result[i] = msg; |
| 5153 | cb(error, result); |
| 5154 | }); |
| 5155 | }; |
| 5156 | |
| 5157 | for (var i = 0; i < ary.length; i++) { |
| 5158 | eachWithIndex(i, ary[i], next); |
| 5159 | } |
| 5160 | } |
| 5161 | |
| 5162 | /* |
| 5163 | * Decodes data when a payload is maybe expected. Possible binary contents are |
no test coverage detected