Function _reduce

  • Reduce array or object by appling function

    For each element, provided function is called with accumulator, elements value, element index/key and original container.

    Type Parameters

    • T1
    • T2

    Parameters

    • fn: ((acc, val, index?, arr?) => T2)
        • (acc, val, index?, arr?): T2
        • Parameters

          • acc: T2
          • val: T1
          • Optional index: number
          • Optional arr: T1[]

          Returns T2

    • val: T2
    • arr: T1[]

    Returns T2

  • Type Parameters

    • T1
    • T2

    Parameters

    • fn: ((acc, val, key?, obj?) => T2)
        • (acc, val, key?, obj?): T2
        • Parameters

          • acc: T2
          • val: T1
          • Optional key: string
          • Optional obj: Record<string, T1>

          Returns T2

    • val: T2
    • obj: Record<string, T1>

    Returns T2