Type Alias ArrReduceCallbackFn<T, R>

ArrReduceCallbackFn<T, R>: ((previousValue: T | R, currentValue: T, currentIndex: number, array: T[]) => R)

The reducer function called for arrReduce.

Type Parameters

  • T

    Identifies the type of array elements

  • R = T

    Identifies the type of the return array elements (defaults to T)

Type declaration

    • (previousValue, currentValue, currentIndex, array): R
    • Parameters

      • previousValue: T | R

        The value resulting from the previous call to callbackFn. On first call, initialValue if specified, otherwise the value of array[0].

      • currentValue: T

        The value of the current element. On first call, the value of array[0] if an initialValue was specified, otherwise the value of array[1].

      • currentIndex: number

        The index position of currentValue in the array. On first call, 0 if initialValue was specified, otherwise 1.

      • array: T[]

        The array being traversed.

      Returns R