swapEither
swapEither<
L
,R
>(x
):Either
<R
,L
>
If the input is a Left, return a Right with the same value, otherwise return a Left with the same value.
Example
swapEither({left: "foobar"})// => {right: "foobar"}
swapEither({right: "foobar"})// => {left: "foobar"}
Type Parameters
• L
The Left type.
• R
The Right type.
Parameters
x
Either
<L
, R
>
Returns
Either
<R
, L
>