Skip to content

Instantly share code, notes, and snippets.

@xeusteerapat
Created January 23, 2021 16:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save xeusteerapat/d6997fdd02ea9c5606e249b5225c1be0 to your computer and use it in GitHub Desktop.
Save xeusteerapat/d6997fdd02ea9c5606e249b5225c1be0 to your computer and use it in GitHub Desktop.
const asyncWrap = promise => promise.then(result => [null, result]).catch(err => [err])
const func = async () => {
const [error, result] = await asyncWrap(doAsyncThing())
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment