Type alias KeyedReducer<N, K, R>

KeyedReducer<N, K, R>: ((value, key, 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

  • N

    The type of the values being processed in the reduction.

  • K = string

    The type of the keys used during the reduction (default: string).

  • R = void

    The type of the accumulated result.

Type declaration

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

      • value: N

        The value being processed in the reduction.

      • key: K

        The key associated with 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.