sweet-monads icon indicating copy to clipboard operation
sweet-monads copied to clipboard

Added rust-like `unwrap()` for `Maybe` and `Either`

Open AlexXanderGrib opened this issue 2 years ago • 1 comments

Why?

Better escape hatch than .value

Usage

function getUser(id: string): Either<UserError, User>;
const value = getUser(11).unwrap().name;

What else

  • Fixed compiler and linter errors

AlexXanderGrib avatar Jul 30 '22 17:07 AlexXanderGrib

Hi @AlexXanderGrib Thank you so much for this amazing PR. There are a few discussing points, but, anyway, it's so useful. Waiting for you response, and one more time, thank you a lot ^_^

JSMonk avatar Aug 02 '22 10:08 JSMonk