Closed ndelangen closed 7 years ago
Maybe, I have a feeling I'm missing misunderstanding something, but it would seem to me the example in the readme is incorrect?
In
async function test() { await db.destroy(); }
Out
function test() { return Promise.resolve().then(function () { return db.destroy(); }).then(function () {}); }
These 2 functions behave differently: the first returns undefined, the second returns a promise?
Perhaps a better example would be:
async function test() { const result = await db.destroy(); return result.ok; }
function test() { return Promise.resolve().then(function () { return db.destroy(); }).then(function (result) { return result.ok; }); }
Does it work like that?
actually returns a Promise (of undefined) - any async function returns a Promise.
async
Maybe, I have a feeling I'm missing misunderstanding something, but it would seem to me the example in the readme is incorrect?
Example
In
Out
These 2 functions behave differently: the first returns undefined, the second returns a promise?
Perhaps a better example would be:
In
Out
Does it work like that?