77// ==ClosureCompiler==
88// @compilation_level ADVANCED_OPTIMIZATIONS
99// @language_out ECMASCRIPT_2019
10- // @js_externs JSONCrush, JSONCrush.crush, JSONCrush.uncrush, JSONCrush.swap
10+ // @js_externs JSONCrush, JSONCrush.crush, JSONCrush.uncrush
1111// ==/ClosureCompiler==
1212
1313export const JSONCrush =
@@ -142,7 +142,7 @@ crush: function(string, maxSubstringLength=50)
142142 string = string . replace ( new RegExp ( delimiter , 'g' ) , '' ) ;
143143
144144 // swap out common json characters
145- string = this . swap ( string ) ;
145+ string = JSONCrushSwap ( string ) ;
146146
147147 // crush with JS crush
148148 const crushed = JSCrush ( string , characters ) ;
@@ -183,10 +183,12 @@ uncrush: function(string)
183183 }
184184
185185 // unswap the json characters in reverse direction
186- return this . swap ( uncrushedString , 0 ) ;
187- } ,
186+ return JSONCrushSwap ( uncrushedString , 0 ) ;
187+ }
188+
189+ } // JSONCrush
188190
189- swap : function ( string , forward = 1 )
191+ const JSONCrushSwap = ( string , forward = 1 ) =>
190192{
191193 // swap out characters for lesser used ones that wont get escaped
192194 const swapGroups =
@@ -213,6 +215,4 @@ swap: function(string, forward=1)
213215 string = swapInternal ( string , swapGroups [ i ] ) ;
214216
215217 return string ;
216- }
217-
218- } // JSONCrush
218+ }
0 commit comments