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

mapSecond

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

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

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

const result1 = E.mapSecond((error: string) => `Error: ${error}`)(E.left("failed"));
// Left("Error: failed")

const result2 = E.mapSecond((error: string) => `Error: ${error}`)(E.right(42));
// Right(42)
function mapSecond<B, J>(fbj: (b: B) => J): <A>(ta: Either<B, A>) => Either<J, A>;
§
mapSecond<B, J>(fbj: (b: B) => J): <A>(ta: Either<B, A>) => Either<J, A>
[src]

§Type Parameters

§Parameters

§
fbj: (b: B) => J
[src]

§Return Type

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