Skip to content

Instantly share code, notes, and snippets.

@stefan-vatov
Created June 13, 2021 03:29
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 stefan-vatov/dd6f6407975ef5747c6291f36a09ecb8 to your computer and use it in GitHub Desktop.
Save stefan-vatov/dd6f6407975ef5747c6291f36a09ecb8 to your computer and use it in GitHub Desktop.
[Async Wrap]
export const asyncWrap = (promise: Promise<any>) =>
promise.then((res) => ({ res, error: null })).catch((error) => ({ res: null, error }));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment