Reduce _.reduceRight and update vendors.

Former-commit-id: f7250ccb4b8f15052c1f1420947c2ac68963a92c
This commit is contained in:
John-David Dalton
2012-09-20 21:06:32 -07:00
parent 5afeed56ef
commit 473dd7660b
8 changed files with 130 additions and 120 deletions

View File

@@ -2220,39 +2220,19 @@
if (!collection) {
return accumulator;
}
var length = collection.length,
noaccum = arguments.length < 3;
if(thisArg) {
callback = bindIterator(callback, thisArg);
if (length !== +length) {
var props = keys(collection);
length = props.length;
}
if (length === +length) {
var iteratee = noCharByIndex && toString.call(collection) == stringClass
? collection.split('')
: collection;
if (length && noaccum) {
accumulator = iteratee[--length];
}
while (length--) {
accumulator = callback(accumulator, iteratee[length], length, collection);
}
return accumulator;
}
var prop,
props = keys(collection);
length = props.length;
if (length && noaccum) {
accumulator = collection[props[--length]];
}
while (length--) {
prop = props[length];
accumulator = callback(accumulator, collection[prop], prop, collection);
}
return accumulator;
return reduce(collection, function(accumulator, value, index, object) {
var index = props ? props[--length] : --length;
return noaccum
? (noaccum = false, object[index])
: callback.call(thisArg, accumulator, object[index], index, object);
}, accumulator);
}
/**