reduce
Updated on August 22, 2024Source codeTests
createReduce is a pipe that transforms an array to reduced array (which can be any data type).
Create reduce
Call createReduce with these parameters to create your reduce function:
Parameter
Type
Required
Description
accumulateFunction
yes
A function that returns the accumulated value.
accumulate receives the accumulated value (any data type), the current item (any data type), and the current item's index (number) as parameters.
initialValueany
no
The initial value of the accumulator.
Defaults to undefined.