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
accumulate
Function
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.
initialValue
any
no
The initial value of the accumulator.
Defaults to undefined
.