Hi there! Are you looking for the official Deno documentation? Try docs.deno.com for all your Deno learning needs.

swap

import { swap } from "https://github.gh-proxy.cn/raw.githubusercontent.com/baetheus/fun/main/either.ts";

Swap the Left and Right values of an Either.

@example
import * as E from "./either.ts";

const result1 = E.swap(E.right(42));
// Left(42)

const result2 = E.swap(E.left("error"));
// Right("error")
function swap<E, A>(ma: Either<E, A>): Either<A, E>;
§
swap<E, A>(ma: Either<E, A>): Either<A, E>
[src]

§Type Parameters

§Parameters

§
ma: Either<E, A>
[src]

§Return Type