Skip to main content
Module

x/ana_utils/mod.ts>dReduce

🅰️ Utility functions for Ana
Go to Latest
function dReduce
import { dReduce } from "https://deno.land/x/ana_utils@v0.0.5/mod.ts";

This function emulates the behavior of Array.prototype.reduce() in Dictionaties. It runs a function that accumulates to a final single value returned.

Type Parameters

EntryType
AcumType

Parameters

dictionary: Dictionary<EntryType>

The dictionary to be reduced.

callback: (
entry: EntryType,
key: string,
acum: AcumType,
) => AcumType

The fucntion that will reduce the dictionary to a single value.

initialValue: AcumType

The initial value for the acummulator.

Returns

A single value reduced from the dictionary.