@szilanor/stream
    Preparing search index...

    Function reduceAsync

    • Returns a collector that returns a single output value by executing a reducer function on each entry of the Iterable.

      Type Parameters

      • T

        Type of items in the source.

      • O

        Type of the output value.

      Parameters

      • reducerFunction: AsyncReduceFunction<T, O>

        A function that defines the sort order of the elements.

      • initialValue: ValueOrFactory<O>

        The initial value to use as the first argument to the reducer function.

      Returns AsyncCollectorFunction<T, O>

      Collector that returns a single output value by executing a reducer function on each entry of the Iterable.

      const result = reduceAsync((a, b) => a + b, 0)([1, 2, 3]);
      console.log(result); // 6