Skip to main content

Type Alias: RawOptionalReducerWithoutFinish<Value, This>

RawOptionalReducerWithoutFinish<Value, This>: object

A reducer that reduces by combining pairs of values using RawOptionalReducerWithoutFinish.add.

Type Parameters

Value = unknown

This = unknown

Type declaration

add()

add: (this, acc, value) => Value

Parameters

this

This

acc

Value

value

Value

Returns

Value

Example

import { or, pipe, reduce } from 'lfi'

console.log(
pipe(
[1, 2, 3, 4],
reduce(
// This is a `RawOptionalReducerWithoutFinish`
{
add: (number1, number2) => number1 + number2,
},
),
or(() => 0),
),
)
//=> 10
Playground

Since

v2.0.0

Defined in

reducers.d.ts:60