CoolFace
Datasetpublic

basant307/AI_Governance_Project

sourceHugging Faceapache-2.0updated 2mo agoView on Hugging Face
0likes45downloads
_arrayReduce.js27 linesDownload Raw Back to lodash-es
1/**2 * A specialized version of `_.reduce` for arrays without support for3 * iteratee shorthands.4 *5 * @private6 * @param {Array} [array] The array to iterate over.7 * @param {Function} iteratee The function invoked per iteration.8 * @param {*} [accumulator] The initial value.9 * @param {boolean} [initAccum] Specify using the first element of `array` as10 *  the initial value.11 * @returns {*} Returns the accumulated value.12 */13function arrayReduce(array, iteratee, accumulator, initAccum) {14  var index = -1,15      length = array == null ? 0 : array.length;16 17  if (initAccum && length) {18    accumulator = array[++index];19  }20  while (++index < length) {21    accumulator = iteratee(accumulator, array[index], index, array);22  }23  return accumulator;24}25 26export default arrayReduce;27 
basant307/AI_Governance_Project · CoolFace