Last active
December 25, 2023 16:24
-
-
Save jonasgeiler/6254bb2bbcfb8da1117b75d2e485cbaa to your computer and use it in GitHub Desktop.
A small try/catch alternative utility function that simplifies error handling with promises (works a bit like Rust's error handling)
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
export const jab = <T>(v: T) => Promise.allSettled([ v ]).then(([ r ]) => r) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Usage