Skip to main content
Module

x/fun/record.ts>reduce

A collection of algebraic data types, lenses, and schemables based on a light weight higher kinded type implementation. Written for deno.
Go to Latest
function reduce
import { reduce } from "https://deno.land/x/fun@v.2.0.0-alpha.11/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.

Examples

Example 1

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

const result = pipe(
  { one: 1, two: 2 },
  R.reduce((sum, value) => sum + value, 0),
); // 3

Parameters

foao: (
o: O,
a: A,
i: string,
) => O
o: O