mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-05 17:37:50 +00:00
Rename var initFromArray to initFromCollection in _.reduce and _.reduceRight.
This commit is contained in:
12
lodash.js
12
lodash.js
@@ -6610,10 +6610,10 @@
|
|||||||
* // => { '1': ['a', 'c'], '2': ['b'] } (iteration order is not guaranteed)
|
* // => { '1': ['a', 'c'], '2': ['b'] } (iteration order is not guaranteed)
|
||||||
*/
|
*/
|
||||||
function reduce(collection, iteratee, accumulator) {
|
function reduce(collection, iteratee, accumulator) {
|
||||||
var initFromArray = arguments.length < 3;
|
var initFromCollection = arguments.length < 3;
|
||||||
return (typeof iteratee == 'function' && isArray(collection))
|
return (typeof iteratee == 'function' && isArray(collection))
|
||||||
? arrayReduce(collection, iteratee, accumulator, initFromArray)
|
? arrayReduce(collection, iteratee, accumulator, initFromCollection)
|
||||||
: baseReduce(collection, getIteratee(iteratee, 4), accumulator, initFromArray, baseEach);
|
: baseReduce(collection, getIteratee(iteratee, 4), accumulator, initFromCollection, baseEach);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -6637,10 +6637,10 @@
|
|||||||
* // => [4, 5, 2, 3, 0, 1]
|
* // => [4, 5, 2, 3, 0, 1]
|
||||||
*/
|
*/
|
||||||
function reduceRight(collection, iteratee, accumulator) {
|
function reduceRight(collection, iteratee, accumulator) {
|
||||||
var initFromArray = arguments.length < 3;
|
var initFromCollection = arguments.length < 3;
|
||||||
return (typeof iteratee == 'function' && isArray(collection))
|
return (typeof iteratee == 'function' && isArray(collection))
|
||||||
? arrayReduceRight(collection, iteratee, accumulator, initFromArray)
|
? arrayReduceRight(collection, iteratee, accumulator, initFromCollection)
|
||||||
: baseReduce(collection, getIteratee(iteratee, 4), accumulator, initFromArray, baseEachRight);
|
: baseReduce(collection, getIteratee(iteratee, 4), accumulator, initFromCollection, baseEachRight);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user