Skip to content

Instantly share code, notes, and snippets.

@jrsinclair
Created December 5, 2018 06:47
Show Gist options
  • Save jrsinclair/d96f6fee8b69167326e70f2a6af40f2e to your computer and use it in GitHub Desktop.
Save jrsinclair/d96f6fee8b69167326e70f2a6af40f2e to your computer and use it in GitHub Desktop.
Elegant Error Handling Code Samples
function either(leftFunc, rightFunc, e) {
return (e instanceof Left) ? leftFunc(e._value) : rightFunc(e._value);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment