fold
import { fold } from "https://github.gh-proxy.cn/raw.githubusercontent.com/baetheus/fun/main/either.ts";Fold an Either into a single value by providing functions for both Left and Right cases, along with an initial value.
@example
import * as E from "./either.ts";
const foldResult = E.fold(
(acc: string, value: number) => `${acc}, ${value}`,
"Values:"
);
const result1 = foldResult(E.right(42));
// "Values:, 42"
const result2 = foldResult(E.left("error"));
// "Values:"