Skip to content

Instantly share code, notes, and snippets.

@firedev
Created April 21, 2020 12:43
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 firedev/754430cba08f331deb3ba6b94b694afb to your computer and use it in GitHub Desktop.
Save firedev/754430cba08f331deb3ba6b94b694afb to your computer and use it in GitHub Desktop.
AsyncWrap — so there is no catch
const asyncWrap = (promise) => (
promise.then(res => [res]).catch(err => [undefined, err])
)
const func = async () => {
const [result, error] = await asynced( doStuff()) )
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment