Reducer<R, N>: ((value, i, accumulation) => R)

A function that reduces or accumulates values of type N by applying a custom logic and returning the accumulated result.

Type Parameters

  • R

    The type of the accumulated result.

  • N

    The type of the values being processed in the reduction.

Type declaration

    • (value, i, accumulation): R
    • Parameters

      • value: N

        The value being processed in the reduction.

      • i: number

        The index of the current value in the reduction (optional).

      • accumulation: R

        The current accumulated result.

      Returns R

Returns

  • The updated accumulated result after processing the current value.