UNPKG

@antv/layout

Version:
36 lines (31 loc) 1.18 kB
/** * The base implementation of `_.reduce` and `_.reduceRight`, without support * for iteratee shorthands, which iterates over `collection` using `eachFunc`. * * @private * @param {Array|Object} collection The collection to iterate over. * @param {Function} iteratee The function invoked per iteration. * @param {*} accumulator The initial value. * @param {boolean} initAccum Specify using the first or last element of * `collection` as the initial value. * @param {Function} eachFunc The function to iterate over `collection`. * @returns {*} Returns the accumulated value. */ var _baseReduce; var hasRequired_baseReduce; function require_baseReduce () { if (hasRequired_baseReduce) return _baseReduce; hasRequired_baseReduce = 1; function baseReduce(collection, iteratee, accumulator, initAccum, eachFunc) { eachFunc(collection, function(value, index, collection) { accumulator = initAccum ? (initAccum = false, value) : iteratee(accumulator, value, index, collection); }); return accumulator; } _baseReduce = baseReduce; return _baseReduce; } export { require_baseReduce as __require }; //# sourceMappingURL=_baseReduce.js.map