Remove unnecessary returns in asyncToGenerator helper (#5548)

* Remove unnecessary returns in asyncToGenerator helper

* Reuse "then" callbacks in asyncToGenerator helpher
This commit is contained in:
Andres Suarez
2017-04-06 11:40:55 -04:00
committed by Henry Zhu
parent 452f8f150c
commit f0dc710a46
2 changed files with 5 additions and 7 deletions

View File

@@ -230,15 +230,13 @@ helpers.asyncToGenerator = template(`
if (info.done) {
resolve(value);
} else {
return Promise.resolve(value).then(function (value) {
step("next", value);
}, function (err) {
step("throw", err);
});
Promise.resolve(value).then(_next, _throw);
}
}
function _next(value) { step("next", value); }
function _throw(err) { step("throw", err); }
return step("next");
_next();
});
};
})