Created
April 21, 2020 12:43
AsyncWrap — so there is no catch
This file contains hidden or 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
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