1
+ /*
2
+ * Copyright 2024 Adobe. All rights reserved.
3
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
4
+ * you may not use this file except in compliance with the License. You may obtain a copy
5
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
6
+ *
7
+ * Unless required by applicable law or agreed to in writing, software distributed under
8
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
9
+ * OF ANY KIND, either express or implied. See the License for the specific language
10
+ * governing permissions and limitations under the License.
11
+ */
1
12
/*
2
13
* This module is another service worker, which will handle the number crunching, i.e.
3
14
* filtering, aggregating, and summarizing the data.
@@ -638,8 +649,10 @@ export class DataChunks {
638
649
if ( Object . keys ( this . seriesIn ) . length ) return this . seriesIn ;
639
650
this . seriesIn = Object . entries ( this . groupedIn )
640
651
. reduce ( ( accOuter , [ groupName , bundles ] ) => {
652
+ // eslint-disable-next-line no-param-reassign
641
653
accOuter [ groupName ] = Object . entries ( this . series )
642
654
. reduce ( ( accInner , [ seriesName , valueFn ] ) => {
655
+ // eslint-disable-next-line no-param-reassign
643
656
accInner [ seriesName ] = bundles . reduce (
644
657
aggregateFn ( valueFn ) ,
645
658
// we reference the totals object here, so that we can
@@ -649,6 +662,7 @@ export class DataChunks {
649
662
return accInner ;
650
663
} , { } ) ;
651
664
// repeat, for interpolations
665
+ // eslint-disable-next-line no-param-reassign
652
666
accOuter [ groupName ] = Object . entries ( this . interpolations )
653
667
. reduce (
654
668
( accInner , [ seriesName , { sourceSeries, interpolationFn } ] ) => {
@@ -657,6 +671,7 @@ export class DataChunks {
657
671
acc [ sourceSeriesName ] = accOuter [ groupName ] [ sourceSeriesName ] ;
658
672
return acc ;
659
673
} , { } ) ;
674
+ // eslint-disable-next-line no-param-reassign
660
675
accInner [ seriesName ] = new InterpolatedAggregate ( interpolationFn , sourceAggregates ) ;
661
676
return accInner ;
662
677
} ,
@@ -722,7 +737,9 @@ export class DataChunks {
722
737
// so that we can calculate metrics
723
738
// later on
724
739
facet . entries . push ( bundle ) ;
740
+ // eslint-disable-next-line no-param-reassign
725
741
facet . count += 1 ;
742
+ // eslint-disable-next-line no-param-reassign
726
743
facet . weight += bundle . weight ;
727
744
return facet ;
728
745
} ;
@@ -753,6 +770,8 @@ export class DataChunks {
753
770
skipped ,
754
771
)
755
772
. reduce ( groupFn ( facetValueFn ) , { } ) ;
773
+
774
+ // eslint-disable-next-line no-param-reassign
756
775
accOuter [ facetName ] = Object . entries ( groupedByFacetIn )
757
776
. reduce ( ( accInner , [ facetValue , bundles ] ) => {
758
777
accInner . push ( bundles
0 commit comments