Use async functions wherever applicable #175
Labels
enhancement
New feature or request
hacktoberfest
Good issues to be tackled by newcomers as part of Hacktoberfest
Using the
async
keyword ensures that a function will always return a Promise. Previously this was achieved by wrapping the function body inreturn Promise.resolve().then(…)
which has a very slight async penalty and can make stack traces harder to read.Definition of done
For all known asynchronous functions:
async
keywordPromise.resolve().then(…)
if applicablereturn Promise.resolve(…)
⮕return …
return Promise.reject(new Error(…))
⮕throw new Error(…)
await
&try/catch
in the function body instead of traditional promise handlingTask list
Tools/libs
Platforms (only the Node.js part)
The text was updated successfully, but these errors were encountered: