-
Notifications
You must be signed in to change notification settings - Fork 44
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Missing semicolon on final statement #2
Comments
@sachya I read about that somewhere, do you have a link to the exact problem description? At best, include it here with an example. Thanks! |
I have the same issues. It seems to obfuscate everything precisely except that it is missing the semicolon at the end of commands and such. For example, when Obfuscating and DeObfuscating the following: Var count = 1; It seems that the way it is translating it is like so: var count = 1 But they are missing the semi-colon in there. Can you help? |
Just as a guide, if I am not mistaken, a semi-colon should literally be translated into a semi-colon when being obfuscated.. At least I think... |
@jdiperla Do you have actual code that leads to a syntax error? Because semicolons should be optional in JavaScript. |
$js = 'function addEvent(element, eventName, func) {
if (element.addEventListener) {
return element.addEventListener(eventName, func, false);
} else if (element.attachEvent) {
return element.attachEvent("on" + eventName, func);
}
};'; Above code will be translated in eval(function(p,a,c,k,e,d){while(c--){if(k[c]){p=p.replace(new RegExp('\\b'+c+'\\b','g'),k[c])}}return p}('7 8(0,2,1){4(0.3){5 0.3(2,1,9)}10 4(0.6){5 0.6("11"+2,1)}};',10,12,'element|func|eventName|addEventListener|if|return|attachEvent|function|addEvent|false|else|on'.split('|'))) Actually a white space is added after last character and not semi-colon. And semicolons are not optional in some scenarios. In my brackets editor large amount of white space is shown (about 20-30 blank |
@jdiperla The way packer works, you don't have to worry about semi-colons inside the program. It is smart enough to handle them. Only the one last semi-colon should be added after clearing the whitespaces. |
@sachya But this code will run fine packed as well? Just tested on jsfiddle. |
@tholu Actually when you will add any other js over the packer code will crash entire site. I use 8-9 consistent js files and some js files generated on the fly, so cannot use packer if doesn't come with semicolon ending. |
I have released 0.2.0 which includes the optional argument $removeSemicolons. |
Hi tholu,
Thanks for continuing the legacy of js packer.
Can you fix the missing semicolon problem in the library?
The text was updated successfully, but these errors were encountered: