* Async array map using after
(ary, each, done)
| 5878 | */ |
| 5879 | |
| 5880 | function map(ary, each, done) { |
| 5881 | var result = new Array(ary.length); |
| 5882 | var next = after(ary.length, done); |
| 5883 | |
| 5884 | var eachWithIndex = function(i, el, cb) { |
| 5885 | each(el, function(error, msg) { |
| 5886 | result[i] = msg; |
| 5887 | cb(error, result); |
| 5888 | }); |
| 5889 | }; |
| 5890 | |
| 5891 | for (var i = 0; i < ary.length; i++) { |
| 5892 | eachWithIndex(i, ary[i], next); |
| 5893 | } |
| 5894 | } |
| 5895 | |
| 5896 | /* |
| 5897 | * Decodes data when a payload is maybe expected. Possible binary contents are |
no test coverage detected