mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-01-29 06:27:49 +00:00
our #reduceRight delegates to #reduce after reversing.
no need to reimplement it. also, reduceRight is worthless :)
This commit is contained in:
@@ -90,10 +90,7 @@
|
||||
_.reduceRight = function(obj, memo, iterator, context) {
|
||||
if (obj && _.isFunction(obj.reduceRight)) return obj.reduceRight(_.bind(iterator, context), memo);
|
||||
var reversed = _.clone(_.toArray(obj)).reverse();
|
||||
each(reversed, function(value, index) {
|
||||
memo = iterator.call(context, memo, value, index, obj);
|
||||
});
|
||||
return memo;
|
||||
return reduce(reversed, memo, iterator, context);
|
||||
};
|
||||
|
||||
// Return the first value which passes a truth test.
|
||||
|
||||
Reference in New Issue
Block a user