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: T2, val: T1, index?: number, arr?: T1[]) => T2
    • val: T2
    • arr: T1[]

    Returns T2

  • 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: T2, val: T1, key?: string, obj?: Record<string, T1>) => T2
    • val: T2
    • obj: Record<string, T1>

    Returns T2