3.1.2 • Published 5 years ago

array-reduce-right-x v3.1.2

Weekly downloads
22
License
MIT
Repository
github
Last release
5 years ago

array-reduce-right-x

Reduce an array (from right to left) to a single value.

module.exports*

This method applies a function against an accumulator and each value of the array (from right-to-left) to reduce it to a single value..

Kind: Exported member
Returns: * - The value that results from the reduction.
Throws:

  • TypeError If array is null or undefined.
  • TypeError If callBack is not a function.
  • TypeError If called on an empty array without an initial value.
ParamTypeDescription
arrayarrayThe array to iterate over.
callBackfunctionFunction to execute for each element.
initialValue*Value to use as the first argument to the first call of the callback. If no initial value is supplied, the first element in the array will be used. Calling reduceRight on an empty array without an initial value is an error.

Example

import reduceRight from 'array-reduce-right-x';

console.log(
  reduceRight(
    [0, 1, 2, 3],
    function(a, b) {
      return a + b;
    },
    0,
  ),
); // sum is 6
3.1.2

5 years ago

3.1.1

5 years ago

3.1.0

5 years ago

3.0.15

5 years ago

3.0.14

5 years ago

3.0.13

5 years ago

3.0.12

5 years ago

3.0.11

5 years ago

3.0.10

5 years ago

3.0.9

5 years ago

3.0.8

5 years ago

3.0.7

5 years ago

3.0.6

5 years ago

3.0.5

5 years ago

3.0.4

5 years ago

3.0.3

5 years ago

3.0.2

5 years ago

3.0.1

5 years ago

3.0.0

5 years ago

2.1.0

6 years ago

2.0.0

7 years ago

1.6.0

7 years ago

1.5.0

7 years ago

1.4.0

7 years ago

1.3.0

7 years ago

1.2.0

7 years ago

1.1.0

7 years ago

1.0.0

7 years ago