babel-plugin-async-to-promises
Version:
Transpile ES7 async/await to vanilla ES6 Promise chains
18 lines (17 loc) • 445 B
JavaScript
function test() {
return Promise.resolve().then(function () {
return Promise.resolve().then(function () {
return db.info();
}).then(function (_resp) {
console.log(_resp);
}).then(function () {
return db.destroy();
}, function (_err) {
return Promise.resolve().then(function () {
return db.destroy();
}).then(function () {
throw _err;
});
});
}).then(function () {});
}