Created
June 13, 2021 03:29
-
-
Save stefan-vatov/dd6f6407975ef5747c6291f36a09ecb8 to your computer and use it in GitHub Desktop.
[Async Wrap]
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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