• Returns the accumulated result of calling fn on each item in an array, or the fallback if list is null or undefined.

    Type Parameters

    • T

    Parameters

    • fallback: T

    Returns ((fn) => ((list) => T))

      • (fn): ((list) => T)
      • Parameters

        Returns ((list) => T)

          • (list): T
          • Parameters

            • list: T[]

            Returns T

    Example

    reduce(99)((acc, next) => acc + next)([3, 6, 9])
    // => 18

    reduce(99)((acc, next) => acc + next)(undefined)
    // => 99

Generated using TypeDoc