Skip to content

xdash API Reference v0.5.14


xdash API Reference / reduce

Function: reduce() ​

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

Defined in: src/array.ts:195

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

Type Parameters ​

T ​

T

U ​

U

Parameters ​

arr ​

T[]

array to reduce

fn ​

(acc, value, index, array) => U

callback to reduce the array

initial ​

U

initial value

Returns ​

U

the reduced value

Released under the MIT License.