Why Gemfury? Push, build, and install  RubyGems npm packages Python packages Maven artifacts PHP packages Go Modules Debian packages RPM packages NuGet packages

Repository URL to install this package:

Details    
chain-able-deps / dist / loop / reduce / reduceArray.js
Size: Mime:
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var size_1 = require("../../util/size");
/**
 * A specialized version of `reduce` for arrays.
 * @since 5.0.0-beta.6
 *
 * @param {Array} [array] The array to iterate over.
 * @param {Function} iteratee The function invoked per iteration.
 * @param {*} [accumulator] The initial value.
 * @param {boolean} [initAccum] Specify using the first element of `array` as
 *  the initial value.
 * @return {*} Returns the accumulated value.
 */
function arrayReduce(array, iteratee, accumulator, initAccum) {
    var index = -1;
    var length = size_1.default(array);
    if (initAccum && length) {
        accumulator = array[++index];
    }
    while (++index < length) {
        accumulator = iteratee(accumulator, array[index], index, array);
    }
    return accumulator;
}
exports.default = arrayReduce;
//# sourceMappingURL=reduceArray.js.map