@@ -48,7 +48,7 @@ function mergeMeasures(parentMeasures: Measures, childMeasures: Measures) {
48
48
for ( const op of keys ( ops ) ) {
49
49
if ( field in parentMeasures ) {
50
50
// add operator to existing measure field
51
- parentMeasures [ field ] [ op ] = new Set ( [ ...( parentMeasures [ field ] [ op ] || [ ] ) , ...ops [ op ] ] ) ;
51
+ parentMeasures [ field ] [ op ] = new Set ( [ ...( parentMeasures [ field ] [ op ] ?? [ ] ) , ...ops [ op ] ] ) ;
52
52
} else {
53
53
parentMeasures [ field ] = { [ op ] : ops [ op ] } ;
54
54
}
@@ -93,22 +93,22 @@ export class AggregateNode extends DataFlowNode {
93
93
const { aggregate, field} = fieldDef ;
94
94
if ( aggregate ) {
95
95
if ( aggregate === 'count' ) {
96
- meas [ '*' ] = meas [ '*' ] || { } ;
96
+ meas [ '*' ] = meas [ '*' ] ?? { } ;
97
97
meas [ '*' ] [ 'count' ] = new Set ( [ vgField ( fieldDef , { forAs : true } ) ] ) ;
98
98
} else {
99
99
if ( isArgminDef ( aggregate ) || isArgmaxDef ( aggregate ) ) {
100
100
const op = isArgminDef ( aggregate ) ? 'argmin' : 'argmax' ;
101
101
const argField = aggregate [ op ] ;
102
- meas [ argField ] = meas [ argField ] || { } ;
102
+ meas [ argField ] = meas [ argField ] ?? { } ;
103
103
meas [ argField ] [ op ] = new Set ( [ vgField ( { op, field : argField } , { forAs : true } ) ] ) ;
104
104
} else {
105
- meas [ field ] = meas [ field ] || { } ;
105
+ meas [ field ] = meas [ field ] ?? { } ;
106
106
meas [ field ] [ aggregate ] = new Set ( [ vgField ( fieldDef , { forAs : true } ) ] ) ;
107
107
}
108
108
109
109
// For scale channel with domain === 'unaggregated', add min/max so we can use their union as unaggregated domain
110
110
if ( isScaleChannel ( channel ) && model . scaleDomain ( channel ) === 'unaggregated' ) {
111
- meas [ field ] = meas [ field ] || { } ;
111
+ meas [ field ] = meas [ field ] ?? { } ;
112
112
meas [ field ] [ 'min' ] = new Set ( [ vgField ( { field, aggregate : 'min' } , { forAs : true } ) ] ) ;
113
113
meas [ field ] [ 'max' ] = new Set ( [ vgField ( { field, aggregate : 'max' } , { forAs : true } ) ] ) ;
114
114
}
@@ -133,16 +133,16 @@ export class AggregateNode extends DataFlowNode {
133
133
const { op, field, as} = s ;
134
134
if ( op ) {
135
135
if ( op === 'count' ) {
136
- meas [ '*' ] = meas [ '*' ] || { } ;
136
+ meas [ '*' ] = meas [ '*' ] ?? { } ;
137
137
meas [ '*' ] [ 'count' ] = new Set ( [ as ? as : vgField ( s , { forAs : true } ) ] ) ;
138
138
} else {
139
- meas [ field ] = meas [ field ] || { } ;
139
+ meas [ field ] = meas [ field ] ?? { } ;
140
140
meas [ field ] [ op ] = new Set ( [ as ? as : vgField ( s , { forAs : true } ) ] ) ;
141
141
}
142
142
}
143
143
}
144
144
145
- for ( const s of t . groupby || [ ] ) {
145
+ for ( const s of t . groupby ?? [ ] ) {
146
146
dims . add ( s ) ;
147
147
}
148
148
0 commit comments