@@ -154,9 +154,9 @@ function accessor_build(obj, p) {
154
154
obj . count = function ( value , propName ) {
155
155
if ( ! arguments . length ) return p . count ;
156
156
if ( ! propName ) {
157
- propName = p . count . length === 0 ? 'count' : ( 'count' + ( p . count . length + 1 ) ) ;
157
+ propName = 'count' ;
158
158
}
159
- p . count . push ( [ value , propName ] ) ;
159
+ p . count = propName ;
160
160
return obj ;
161
161
} ;
162
162
@@ -179,7 +179,7 @@ function accessor_build(obj, p) {
179
179
if ( p . sum ) console . warn ( 'SUM aggregation is being overwritten by AVG aggregation' ) ;
180
180
p . sum = value ;
181
181
p . avg = true ;
182
- if ( p . count . length === 0 ) p . count . push ( [ true , 'count' ] ) ;
182
+ p . count = 'count' ;
183
183
} else {
184
184
p . avg = value ;
185
185
}
@@ -296,7 +296,7 @@ function accessor_build(obj, p) {
296
296
if ( typeof ( value ) === 'function' ) {
297
297
p . sumOfSquares = value ;
298
298
p . sum = value ;
299
- if ( p . count . length === 0 ) p . count . push ( [ true , 'count' ] ) ;
299
+ p . count = 'count' ;
300
300
p . std = true ;
301
301
} else {
302
302
p . std = value ;
@@ -469,11 +469,9 @@ function build_function(p, f, path) {
469
469
} ;
470
470
471
471
if ( p . count || p . std ) {
472
- p . count . forEach ( function ( c ) {
473
- f . reduceAdd = reductio_count . add ( f . reduceAdd , path , c [ 1 ] ) ;
474
- f . reduceRemove = reductio_count . remove ( f . reduceRemove , path , c [ 1 ] ) ;
475
- f . reduceInitial = reductio_count . initial ( f . reduceInitial , path , c [ 1 ] ) ;
476
- } ) ;
472
+ f . reduceAdd = reductio_count . add ( f . reduceAdd , path , p . count ) ;
473
+ f . reduceRemove = reductio_count . remove ( f . reduceRemove , path , p . count ) ;
474
+ f . reduceInitial = reductio_count . initial ( f . reduceInitial , path , p . count ) ;
477
475
}
478
476
479
477
if ( p . sum ) {
0 commit comments