Skip to content

Commit b0f8f22

Browse files
cleaner
1 parent 37500d0 commit b0f8f22

File tree

3 files changed

+10
-10
lines changed

3 files changed

+10
-10
lines changed

JSONCrush.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
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

1313
export 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+
}

JSONCrush.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ <h1>JSONCrush Demo - Compress JSON into URL friendly strings</h1>
2525
<br><br><br><div id=div_unit_test_results></div>
2626
<script type=module>
2727

28-
// load JSONCrush module into global scope
28+
// Load JSONCrush module into global scope!
2929
import {JSONCrush} from './JSONCrush.js';
3030
window.JSONCrush = JSONCrush;
3131

0 commit comments

Comments
 (0)