@@ -41,41 +41,35 @@ export class SplitsCacheInMemory extends AbstractSplitsCacheSync {
4141 if ( usesSegments ( previousSplit ) ) this . segmentsCount -- ;
4242 }
4343
44- if ( split ) {
45- // Store the Split.
46- this . splitsCache [ name ] = split ;
47- // Update TT cache
48- const ttName = split . trafficTypeName ;
49- this . ttCache [ ttName ] = ( this . ttCache [ ttName ] || 0 ) + 1 ;
50- this . addToFlagSets ( split ) ;
51-
52- // Add to segments count for the new version of the Split
53- if ( usesSegments ( split ) ) this . segmentsCount ++ ;
54-
55- return true ;
56- } else {
57- return false ;
58- }
44+ // Store the Split.
45+ this . splitsCache [ name ] = split ;
46+ // Update TT cache
47+ const ttName = split . trafficTypeName ;
48+ this . ttCache [ ttName ] = ( this . ttCache [ ttName ] || 0 ) + 1 ;
49+ this . addToFlagSets ( split ) ;
50+
51+ // Add to segments count for the new version of the Split
52+ if ( usesSegments ( split ) ) this . segmentsCount ++ ;
53+
54+ return true ;
5955 }
6056
6157 removeSplit ( name : string ) : boolean {
6258 const split = this . getSplit ( name ) ;
63- if ( split ) {
64- // Delete the Split
65- delete this . splitsCache [ name ] ;
59+ if ( ! split ) return false ;
6660
67- const ttName = split . trafficTypeName ;
68- this . ttCache [ ttName ] -- ; // Update tt cache
69- if ( ! this . ttCache [ ttName ] ) delete this . ttCache [ ttName ] ;
70- this . removeFromFlagSets ( split . name , split . sets ) ;
61+ // Delete the Split
62+ delete this . splitsCache [ name ] ;
7163
72- // Update the segments count.
73- if ( usesSegments ( split ) ) this . segmentsCount -- ;
64+ const ttName = split . trafficTypeName ;
65+ this . ttCache [ ttName ] -- ; // Update tt cache
66+ if ( ! this . ttCache [ ttName ] ) delete this . ttCache [ ttName ] ;
67+ this . removeFromFlagSets ( split . name , split . sets ) ;
7468
75- return true ;
76- } else {
77- return false ;
78- }
69+ // Update the segments count.
70+ if ( usesSegments ( split ) ) this . segmentsCount -- ;
71+
72+ return true ;
7973 }
8074
8175 getSplit ( name : string ) : ISplit | null {
0 commit comments