plainfp - v0.1.0
    Preparing search index...

    Function reduce

    • Fold elements left-to-right into a single accumulated value starting from initial.

      Dual API — works data-first or curried for use in pipe.

      Type Parameters

      • T
      • U

      Parameters

      • xs: readonly T[]
      • initial: U
      • fn: (acc: U, x: T, i: number) => U

      Returns U

      pipe(
      orders,
      Arrays.reduce(0, (total, o) => total + o.price),
      )
    • Fold elements left-to-right into a single accumulated value starting from initial.

      Dual API — works data-first or curried for use in pipe.

      Type Parameters

      • T
      • U

      Parameters

      • initial: U
      • fn: (acc: U, x: T, i: number) => U

      Returns (xs: readonly T[]) => U

      pipe(
      orders,
      Arrays.reduce(0, (total, o) => total + o.price),
      )