tryToEither
Convert the Try
to an Either
, where Success
is converted to Right
, and
Failure
is converted to Left
.
Example
tryToEither("foobar")// => {right: "foobar"}
tryToEither(new Error("foobar"))// => {left: Error("foobar")}
Type Parameters
• T extends unknown
The value type.
Parameters
x
T
The Try
to transform.