Options
All
  • Public
  • Public/Protected
  • All
Menu

Module reduceRight

Index

References

Functions Collection

References

Renames and re-exports reduceRight

Collection Functions

  • reduceRight<T, R>(collection?: Record<string, T>, iteratee?: AccCollectionIteratee<T, R>, accumulator?: R): R
  • reduceRight<T, R>(collection?: ArrayLike<T>, iteratee?: AccCollectionIteratee<T, R>, accumulator?: R): R
  • This method is like reduce except that it iterates over elements of collection from right to left.

    since

    5.12.0

    see

    reduce

    example
    const array = [[0, 1], [2, 3], [4, 5]]

    reduceRight(array, (flattened, other) => flattened.concat(other), [])
    // => [4, 5, 2, 3, 0, 1]

    Type parameters

    • T

    • R

    Parameters

    • Optional collection: Record<string, T>

      The collection to iterate over.

    • Optional iteratee: AccCollectionIteratee<T, R>

      The function invoked per iteration.

    • Optional accumulator: R

      The initial value.

    Returns R

    Returns the accumulated value.

  • Type parameters

    • T

    • R

    Parameters

    • Optional collection: ArrayLike<T>
    • Optional iteratee: AccCollectionIteratee<T, R>
    • Optional accumulator: R

    Returns R