-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Way to reduce +=1 to ++ in for loops? #3280
Comments
Added the feature to |
Released as terser 3.10.8 |
You might want to pin that version, as I had to revert the feature due to issues. I might try to do it again sometime, but for now it's out. |
It's very tricky to do correctly, because when the variable is a string it change the meaning: // 0, 1, 2
for(var i = 0; i < 3; i += 1){console.log(i)}
// "0", "01"
for(var i = "0"; i < 3; i += 1){console.log(i)} // |
Maybe an "assume no implicit type coercion anywhere" optimization flag could be useful? |
@drathier, you'd have to specify it much more clearly than that. E.g. I agree that |
|
Bug report or feature request?
feature req
Uglify version (
uglifyjs -V
)3.4.9
JavaScript input
The
uglifyjs
CLI command executed orminify()
options used.uglifyjs [filename.js]
JavaScript output or error produced.
for(var i=0;i<3;i+=1){console.log(i)}
maybe this is a source code issue and outside the scope of minification, just wondering if there was/could be an option to turn +=1 and -=1 to ++ and -- ?
The text was updated successfully, but these errors were encountered: