mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-10 19:07:49 +00:00
Make _.reduce, _.reduceRight, & _.transform to use lodash.createCallback. [closes #388]
This commit is contained in:
6
dist/lodash.compat.js
vendored
6
dist/lodash.compat.js
vendored
@@ -3113,7 +3113,7 @@
|
||||
}
|
||||
}
|
||||
if (callback) {
|
||||
callback = baseCreateCallback(callback, thisArg, 4);
|
||||
callback = lodash.createCallback(callback, thisArg, 4);
|
||||
(isArr ? baseEach : forOwn)(object, function(value, index, object) {
|
||||
return callback(accumulator, value, index, object);
|
||||
});
|
||||
@@ -3960,7 +3960,7 @@
|
||||
*/
|
||||
function reduce(collection, callback, accumulator, thisArg) {
|
||||
var noaccum = arguments.length < 3;
|
||||
callback = baseCreateCallback(callback, thisArg, 4);
|
||||
callback = lodash.createCallback(callback, thisArg, 4);
|
||||
|
||||
if (isArray(collection)) {
|
||||
var index = -1,
|
||||
@@ -4003,7 +4003,7 @@
|
||||
*/
|
||||
function reduceRight(collection, callback, accumulator, thisArg) {
|
||||
var noaccum = arguments.length < 3;
|
||||
callback = baseCreateCallback(callback, thisArg, 4);
|
||||
callback = lodash.createCallback(callback, thisArg, 4);
|
||||
forEachRight(collection, function(value, index, collection) {
|
||||
accumulator = noaccum
|
||||
? (noaccum = false, value)
|
||||
|
||||
Reference in New Issue
Block a user