deno.land / x / lodash@4.17.19 / npm-package / reduceRight.js

reduceRight.js
نووسراو ببینە
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
var arrayReduceRight = require('./_arrayReduceRight'), baseEachRight = require('./_baseEachRight'), baseIteratee = require('./_baseIteratee'), baseReduce = require('./_baseReduce'), isArray = require('./isArray');
/** * This method is like `_.reduce` except that it iterates over elements of * `collection` from right to left. * * @static * @memberOf _ * @since 0.1.0 * @category Collection * @param {Array|Object} collection The collection to iterate over. * @param {Function} [iteratee=_.identity] The function invoked per iteration. * @param {*} [accumulator] The initial value. * @returns {*} Returns the accumulated value. * @see _.reduce * @example * * var array = [[0, 1], [2, 3], [4, 5]]; * * _.reduceRight(array, function(flattened, other) { * return flattened.concat(other); * }, []); * // => [4, 5, 2, 3, 0, 1] */function reduceRight(collection, iteratee, accumulator) { var func = isArray(collection) ? arrayReduceRight : baseReduce, initAccum = arguments.length < 3;
return func(collection, baseIteratee(iteratee, 4), accumulator, initAccum, baseEachRight);}
module.exports = reduceRight;
lodash

Version Info

Tagged at
3 years ago

External Dependencies

No external dependencies 🎉