我对如何使用co
包使我的后续异步代码更具可读性感到困惑
https://www.npmjs.com/package/co
async.each(longList, function(address, callback) {
googleMapsClient.geocode({
address: address
}, function(err, response) {
// send the response to database
http.request(options, function(res) {
// now process the next address
callback();
});
}
}, function(err) {
if (err) throw err;
}
我也欢迎上面的任何其他编码风格,无论代码更清洁