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

map

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

Apply a function to the Right value of an Either. Left values are unchanged.

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

const result1 = E.map((n: number) => n * 2)(E.right(21));
// Right(42)

const result2 = E.map((n: number) => n * 2)(E.left("error"));
// Left("error")
function map<A, I>(fai: (a: A) => I): <B>(ta: Either<B, A>) => Either<B, I>;
§
map<A, I>(fai: (a: A) => I): <B>(ta: Either<B, A>) => Either<B, I>
[src]

§Type Parameters

§Parameters

§
fai: (a: A) => I
[src]

§Return Type

§
<B>(ta: Either<B, A>) => Either<B, I>
[src]