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/record.ts";

Collect all of the A values in a ReadonlyRecord into a single O value by the process of reduction. The order of key/value pairs in this reduction are stable and determined by ecmascript standard here.

@example
import * as R from "./record.ts";
import { pipe } from "./fn.ts";

const result = pipe(
  { one: 1, two: 2 },
  R.fold((sum, value) => sum + value, 0),
); // 3
function fold<A, O>(foao: (
o: O,
a: A,
i: string,
) => O
, o: O): (ua: ReadonlyRecord<A>) => O;
§
fold<A, O>(foao: (o: O, a: A, i: string) => O, o: O): (ua: ReadonlyRecord<A>) => O
[src]

§Type Parameters

§Parameters

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

§Return Type

§
(ua: ReadonlyRecord<A>) => O
[src]