iter-fns - v0.13.0
    Preparing search index...

    Function reduce

    • Folds over each element of the iterable with a reducer function.

      The initial value for the fold is the first element of the iterable.

      A right fold can be performed by calling reversed on the iterable first.

      Type Parameters

      • T

        type of the item

      Parameters

      • iterable: Iterable<T>

        the iterable

      • f: (z: T, x: T, i: number) => T

        the step function, which takes the accumulator and item

      Returns undefined | T

      if the iterable is empty

    • Folds over each element of the iterable with a reducer function.

      A right fold can be performed by calling reversed on the iterable first.

      Type Parameters

      • T

        type of the item

      • U

      Parameters

      • iterable: Iterable<T>

        the iterable

      • f: (z: U, x: T, i: number) => U

        the step function, which takes the accumulator and item

      • z: U

        the starting accumulator

      Returns U