DrKillshot / unwrap

A functional programming library for typescript developers
https://drkillshot.github.io/unwrap/
1 stars 1 forks source link

Added fromThrowable constructor in Either monad #7

Closed DrKillshot closed 1 week ago

DrKillshot commented 1 week ago

In our codebase we can use functions/method we have no control over which can throw errors. If we want to keep these errors contained we could encapsulate them in the Either monad. A constructor of the type Either.fromThrowable(throwableMethod()) could solve the problem.

fromThrowable should: