@@ -155,31 +155,29 @@ exports.supplyDefaults = function(transformIn, traceOut) {
155
155
arrayAttrs [ groups ] = 0 ;
156
156
}
157
157
158
- var aggregationsIn = transformIn . aggregations ;
158
+ var aggregationsIn = transformIn . aggregations || [ ] ;
159
159
var aggregationsOut = transformOut . aggregations = new Array ( aggregationsIn . length ) ;
160
160
var aggregationOut ;
161
161
162
162
function coercei ( attr , dflt ) {
163
163
return Lib . coerce ( aggregationsIn [ i ] , aggregationOut , aggAttrs , attr , dflt ) ;
164
164
}
165
165
166
- if ( aggregationsIn ) {
167
- for ( i = 0 ; i < aggregationsIn . length ; i ++ ) {
168
- aggregationOut = { } ;
169
- var target = coercei ( 'target' ) ;
170
- var func = coercei ( 'func' ) ;
171
- var enabledi = coercei ( 'enabled' ) ;
172
-
173
- // add this aggregation to the output only if it's the first instance
174
- // of a valid target attribute - or an unused target attribute with "count"
175
- if ( enabledi && target && ( arrayAttrs [ target ] || ( func === 'count' && arrayAttrs [ target ] === undefined ) ) ) {
176
- if ( func === 'stddev' ) coercei ( 'funcmode' ) ;
177
-
178
- arrayAttrs [ target ] = 0 ;
179
- aggregationsOut [ i ] = aggregationOut ;
180
- }
181
- else aggregationsOut [ i ] = { enabled : false } ;
166
+ for ( i = 0 ; i < aggregationsIn . length ; i ++ ) {
167
+ aggregationOut = { } ;
168
+ var target = coercei ( 'target' ) ;
169
+ var func = coercei ( 'func' ) ;
170
+ var enabledi = coercei ( 'enabled' ) ;
171
+
172
+ // add this aggregation to the output only if it's the first instance
173
+ // of a valid target attribute - or an unused target attribute with "count"
174
+ if ( enabledi && target && ( arrayAttrs [ target ] || ( func === 'count' && arrayAttrs [ target ] === undefined ) ) ) {
175
+ if ( func === 'stddev' ) coercei ( 'funcmode' ) ;
176
+
177
+ arrayAttrs [ target ] = 0 ;
178
+ aggregationsOut [ i ] = aggregationOut ;
182
179
}
180
+ else aggregationsOut [ i ] = { enabled : false } ;
183
181
}
184
182
185
183
// any array attributes we haven't yet covered, fill them with the default aggregation
0 commit comments