All our webservices are passed to our XHR via an associative array. IE:
new XHR({"year": 2015, "week": 6}, ...);
All our scripts are added to a single file, and this is then Uglified via (Essentially mangle and compress everything except for our entry point):
uglifyjs --mangle toplevel --screw-ie8 --compress --mangle-regex="/(?s)^((?!$$).)*$/" --reserve-domprops --reserved-file reserved -- input
The problem is, the year and week field keep getting obfuscated. So I tried putting a $$ infront, so we now have $$year and $$week. To get this to work, I added the regex argument to the UglifyJS command above. I am trying to negate the lookup, so it will mangle all properties except those with a $$ at the start (Can be any set of characters, just using $$ as a starting point).
My questions:
- Is this the best way to do it? Is there a way in UglifyJS to ignore certain associative arrays?
- Is my regex right? I've tried escaping the two dollar signs, I've tried with __instead of$$as well as several other attempts (Note: My regex is not good)
- If the regex is wrong, is there somewhere that would detail a method for creating a valid regex?
EDIT: Resolved. Needed to use this:
uglifyjs --mangle toplevel --screw-ie8 --mangle-props --mangle-regex="/^((?!\$\$).)*$/" --reserve-domprops --reserved-file reserved -- input > output
 
    