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

fold

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

Fold over a Datum to produce a single value.

@example
import { fold, initial, replete } from "./datum.ts";

const folder = fold(
  (acc: number, value: number) => acc + value,
  0
);

console.log(folder(initial)); // 0
console.log(folder(replete(5))); // 5
function fold<A, O>(foao: (o: O, a: A) => O, o: O): (ta: Datum<A>) => O;
§
fold<A, O>(foao: (o: O, a: A) => O, o: O): (ta: Datum<A>) => O
[src]

§Type Parameters

§Parameters

§
foao: (o: O, a: A) => O
[src]

§Return Type

§
(ta: Datum<A>) => O
[src]