MCPcopy Create free account
hub / github.com/RubyLouvre/anu / arrayReduce

Function arrayReduce

test/babel.js:27885–27896  ·  view source on GitHub ↗

* A specialized version of `_.reduce` for arrays without support for * iteratee shorthands. * * @private * @param {Array} [array] The array to iterate over. * @param {Function} iteratee The function invoked per iteration. * @param {*} [accumulator] The initial value. * @param {boolean}

(array, iteratee, accumulator, initAccum)

Source from the content-addressed store, hash-verified

27883 * @returns {*} Returns the accumulated value.
27884 */
27885 function arrayReduce(array, iteratee, accumulator, initAccum) {
27886 var index = -1,
27887 length = array == null ? 0 : array.length;
27888
27889 if (initAccum && length) {
27890 accumulator = array[++index];
27891 }
27892 while (++index < length) {
27893 accumulator = iteratee(accumulator, array[index], index, array);
27894 }
27895 return accumulator;
27896 }
27897
27898 module.exports = arrayReduce;
27899

Callers 2

cloneMapFunction · 0.85
cloneSetFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected