bimap
import { bimap } from "https://github.gh-proxy.cn/raw.githubusercontent.com/baetheus/fun/main/either.ts";Apply functions to both sides of an Either. The first function is applied to Left values, the second to Right values.
@example
import * as E from "./either.ts";
import { pipe } from "./fn.ts";
const result1 = pipe(
E.right(21),
E.bimap(
(error) => `Error: ${error}`,
(value) => value * 2
)
);
// Right(42)
const result2 = pipe(
E.left("Something failed"),
E.bimap(
(error) => `Error: ${error}`,
(value) => value * 2
)
);
// Left("Error: Something failed")