1 var aFunction = require('./_a-function')
2 , toObject = require('./_to-object')
3 , IObject = require('./_iobject')
4 , toLength = require('./_to-length');
6 module.exports = function(that, callbackfn, aLen, memo, isRight){
10 , length = toLength(O.length)
11 , index = isRight ? length - 1 : 0
12 , i = isRight ? -1 : 1;
20 if(isRight ? index < 0 : length <= index){
21 throw TypeError('Reduce of empty array with no initial value');
24 for(;isRight ? index >= 0 : length > index; index += i)if(index in self){
25 memo = callbackfn(memo, self[index], index, O);