fold
import { fold } from "https://github.gh-proxy.cn/raw.githubusercontent.com/baetheus/fun/main/these.ts";Fold over a These to produce a single value.
@example
import { fold, left, right, both } from "./these.ts";
const folder = fold(
(acc: number, value: number) => acc + value,
0
);
console.log(folder(left("Error"))); // 0
console.log(folder(right(5))); // 5
console.log(folder(both("Warning", 3))); // 3