* Async array map using after
(ary, each, done)
| 3585 | */ |
| 3586 | |
| 3587 | function map(ary, each, done) { |
| 3588 | var result = new Array(ary.length); |
| 3589 | var next = after(ary.length, done); |
| 3590 | |
| 3591 | var eachWithIndex = function(i, el, cb) { |
| 3592 | each(el, function(error, msg) { |
| 3593 | result[i] = msg; |
| 3594 | cb(error, result); |
| 3595 | }); |
| 3596 | }; |
| 3597 | |
| 3598 | for (var i = 0; i < ary.length; i++) { |
| 3599 | eachWithIndex(i, ary[i], next); |
| 3600 | } |
| 3601 | } |
| 3602 | |
| 3603 | /* |
| 3604 | * Decodes data when a payload is maybe expected. Possible binary contents are |
no test coverage detected