Skip to main content

Type Alias: RawReducerWithoutFinish<Value, Acc, This>

RawReducerWithoutFinish<Value, Acc, This> = object

Defined in: reducers.d.ts:163

A reducer that reduces by creating an initial accumulator using RawReducerWithoutFinish.create and then adding values to the accumulator values using RawReducerWithoutFinish.add.

Example​

import { pipe, reduce } from 'lfi'

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

Since​

v2.0.0

Type Parameters​

Value​

Value = unknown

Acc​

Acc = Value

This​

This = unknown

Properties​

add()​

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

Defined in: reducers.d.ts:169

Parameters​

this​

This

acc​

Acc

value​

Value

Returns​

Acc


create()​

create: (this) => Acc

Defined in: reducers.d.ts:168

Parameters​

this​

This

Returns​

Acc