123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051 |
- var arrayReduce = require('./_arrayReduce'),
- baseEach = require('./_baseEach'),
- baseIteratee = require('./_baseIteratee'),
- baseReduce = require('./_baseReduce'),
- isArray = require('./isArray');
-
-
- function reduce(collection, iteratee, accumulator) {
- var func = isArray(collection) ? arrayReduce : baseReduce,
- initAccum = arguments.length < 3;
-
- return func(collection, baseIteratee(iteratee, 4), accumulator, initAccum, baseEach);
- }
-
- module.exports = reduce;
|