I've got a pretty strong grasp of ES6, but I can't wrap my head around this:
How can I return from an async
function from within a nested callback?
e.g.:
async function test () {
someNonPromiseUsingFunction (data => return data)
}
as opposed to nesting everything in a promise:
function test () {
return new Promise (resolve => someNonPromiseUsingFunction (data => resolve (data)))
}
I know it's not necessary, I just want to consistently use async
and await
in my code instead of mixing it with manual promise initializations.