Every line of 'jquery reduce' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your JavaScript code is secure.
97 return function reduce( acc, data ) { 98 var i, j, A, B; 99 100 // [0] Increment the number of values: 101 acc.N += 1; 102 103 // [1] Compute the deltas where a delta is the difference between a new value and the corresponding dataset's current mean value... 104 for ( i = 0; i < numMeans; i++ ) { 105 accessor = accessors[ names[ i ] ]; 106 deltas[ i ] = accessor( data ) - acc.means[ i ]; 107 } 108 109 // [2] Update the covariance matrix... 110 for ( i = 0; i < numMeans; i++ ) { 111 for ( j = 0; j < numMeans; j++ ) { 112 A = acc.cov[i][j] * (acc.N-1); 113 B = (acc.N-1) / acc.N * deltas[i] * deltas[j]; 114 acc.cov[i][j] = ( A + B ) / acc.N; 115 } 116 } 117 118 // [3] Update the means to incorporate the new values... 119 for ( i = 0; i < numMeans; i++ ) { 120 acc.means[ i ] += deltas[ i ] / acc.N; 121 } 122 123 return acc; 124 }; // end FUNCTION reduce()
67 function reduce(array, reducer, index) { 68 return array.reduce(function(prev, current) { 69 return reducer(prev, current[index]); 70 }, array[0][index]); 71 }
104 function reduce(arr, fn){ 105 var res = arr[0]; 106 for(var i=1,l=arr.length;i
12 function reduce ( arr, fun, base ) { 13 return Array.prototype.reduce.call( arr, fun, base ); 14 }
52 function reduceArr (arr, fn, baseObject = {}) { 53 return arr.reduce((acc, item) => { 54 const [k, v] = fn(item, acc) 55 acc[k] = v 56 return acc 57 }, baseObject) 58 }
1 function reduce(func, arr, memo) { 2 var len = arr.length, 3 i = 0, 4 accum = memo; 5 6 for (; i < len; i++) { 7 accum = func(accum, arr[i]); 8 } 9 10 return accum; 11 }
102 function reduce ( f, acc, iterable ) { 103 if ( !isDefined( iterable ) ) return acc; 104 105 return isArray( iterable ) 106 ? reduceArray( f, acc, iterable ) 107 : reduceObject( f, acc, iterable ); 108 }
30 var reduce = function reduce(obj, index) { 31 if (!obj) { 32 return null; 33 } 34 return obj[index]; 35 };
371 export function reduce(obj, func, value) { 372 for (const i in obj) { 373 value = func(value, obj[i], i); 374 } 375 return value; 376 }
66 function reduce() { 67 var delta = 0, 68 delta_n = 0, 69 term1 = 0; 70 /** 71 * FUNCTION: reduce( acc, data ) 72 * Defines the data reduction. 73 * 74 * @private 75 * @param {object} acc - accumulation object containing the following properties: N, mean, M1, M2, M3. 'N' is the observatio number. 'mean' is the mean accumulator. 'M1' is the difference accumulator. 'M2' is the sum of squared difference accumulator. 'M3' is the cubed difference accumulator. 76 * @param {number} data - numeric stream data 77 * @returns {object} accumulation object 78 */ 79 return function reduce( acc, x ) { 80 acc.N += 1; 81 82 delta = x - acc.mean; 83 delta_n = delta / acc.N; 84 85 term1 = delta * delta_n * (acc.N-1); 86 87 acc.M3 += term1*delta_n*(acc.N-2) - 3*delta_n*acc.M2; 88 acc.M2 += term1; 89 acc.M1 += delta; 90 acc.mean += delta_n; 91 92 return acc; 93 }; 94 } // end FUNCTION reduce()