* Async array map using after
(ary, each, done)
| 253 | */ |
| 254 | |
| 255 | function map(ary, each, done) { |
| 256 | const results = new Array(ary.length); |
| 257 | let count = 0; |
| 258 | |
| 259 | for (let i = 0; i < ary.length; i++) { |
| 260 | each(ary[i], (error, msg) => { |
| 261 | results[i] = msg; |
| 262 | if (++count === ary.length) { |
| 263 | done(null, results); |
| 264 | } |
| 265 | }); |
| 266 | } |
| 267 | } |
| 268 | |
| 269 | /* |
| 270 | * Decodes data when a payload is maybe expected. Possible binary contents are |
no test coverage detected