Type Alias: FunctionReducer()<Value>
FunctionReducer<
Value
>: (acc
,value
) =>Value
A reducer that reduces by combining pairs of values using function application.
Type Parameters
• Value = unknown
Parameters
acc
Value
value
Value
Returns
Value
Example
import { or, pipe, reduce } from 'lfi'
console.log(
pipe(
[1, 2, 3, 4],
reduce(
// This is a `FunctionReducer`
(number1, number2) => number1 + number2,
),
or(() => 0),
),
)
//=> 10
Since
v2.0.0