My new job has a lot of functions that look like this
function doThing() {
return new Promise((resolve, reject) => {
if (???) resolve(???)
reject(???)
})
}
I'm considering refactoring it to
async function doThing() {
if (???) return ???
throw ???
}
But just wanted to make sure there are no differences to the two before I do.