User:Alexis Jazz/AJSJSMangler

Is it "A JS JS mangler" (A JavaScript Mangler written in JavaScript) or AJ's JavaScript Mangler?

AJSJSMangler is a script that can mangle userscripts to make them smaller. Specifically object keys, which UglifyJS won't touch as far as I could tell. It can be used in addition to a minifier. Frankly it was just written to minify User:Alexis Jazz/Bawl more effectively. Will it work for your scripts too? Nobody knows

AJSJSMangler also has some options for whitespace removal. Compared to UglifyJS, AJSJSMangler is somewhat less efficient in that department. It's not too far off, for Bawl UglifyJS only shaves off another 7%. When used on its own (without AJSJSMangler's key mangling), UglifyJS performs much worse than AJSJSMangler for Bawl. AJSJSMangler is more likely to introduce problems as it hasn't been tested nearly as well as UglifyJS. On the other hand: AJSJSMangler doesn't necessarily make JSHint cry. The highest compression is achieved by using AJSJSMangler followed by UglifyJS.

If you didn't get the message yet, NO, this is not a polished tool!

Usage: run  from the JS console. (source) If you can't do that, this script is not for you. DO NOT PUT IN COMMON.JS. Paste your script, mangle it, then process it with a regular minifier like minJS or UglifyJS. (online demo: https://lisperator.net/uglifyjs/#demo) Rules: Example:
 * 1) The first occurrence of "window.myScriptsMainVariableName = {};" will be assumed to be the main variable of your script.
 * 2) This variable and its contents CANNOT be shared with other script files.
 * 3) If keys appear in strings anywhere you have a problem. Instead of writing  you'll have to write
 * 4) Put ALL your crap in there!
 * 5) Only myScriptsMainVariableName.someNameToBeMangled gets mangled. In myScriptsMainVariableName.someNameToBeMangled.someObject, "someObject" is SAFE from mangling.
 * 6) Any line that contains myScriptsMainVariableName.debug gets removed entirely.
 * 7) ZERO CHECKS IF THIS BREAKS YOUR SCRIPT. IF YOU FOLLOWED THE RULES AND ALL THE STARS ALIGN IT SHOULDN'T. PROBABLY. YMMV. PROVIDED AS IS. DO NOT BLINDLY APPLY THIS TO YOUR SCRIPTS.
 * 8) YOU DO NOT TALK ABOUT wait no

Becomes:

Go mangle yourself
No problem.