Module

x/ultra/src/deps.ts>LRU#reduce

💎 Modern Streaming React Framework in Deno
Go to Latest
method LRU.prototype.reduce
import { LRU } from "https://dotland.deno.dev/x/ultra@v1.0.1/src/deps.ts";

Executes a reducer function (that you provide) on each element of the array, resulting in single output value

Parameters

callbackfn: (
previousValue: [string, T],
currentValue: [string, T],
currentIndex: number,
array: [string, T][],
) => [string, T]

A function to execute on each element in the array (except for the first, if no initialValue is supplied)

optional
initialValue: [string, T]

A value to use as the first argument to the first call of the callback. If no initialValue is supplied, the first element in the array will be used as the initial accumulator value and skipped as currentValue. Calling reduce() on an empty array without an initialValue will throw a TypeError.

Returns

[string, T]

Parameters

callbackfn: (
previousValue: U,
currentValue: [string, T],
currentIndex: number,
array: [string, T][],
) => U
initialValue: U