xdashReadme | API


xdash / reduce

Function: reduce()

reduce<T, U>(arr, fn, initial): U

Reduces an array to a value which is the accumulated result of running each element in the array through the callback.

Type parameters

T

U

Parameters

arr: T[]

array to reduce

fn

callback to reduce the array

initial: U

initial value

Returns

U

the reduced value

Source

array.ts:154