00001 00013 function arrayReduce(array, iteratee, accumulator, initAccum) { 00014 var index = -1, 00015 length = array == null ? 0 : array.length; 00016 00017 if (initAccum && length) { 00018 accumulator = array[++index]; 00019 } 00020 while (++index < length) { 00021 accumulator = iteratee(accumulator, array[index], index, array); 00022 } 00023 return accumulator; 00024 } 00025 00026 module.exports = arrayReduce;