Closed
Description
I'm trying to use Uglify to compress and obscure Adobe ExtendScript ( ES3 dialect of JS ) code. Uglify seems to strip parentheses in nested ternary expressions. ExtendScript can't understand this and throws an error: Expected: :
.
Input code:
// input.js
function toInteger(value) {
var result = parseFloat(value);
var remainder = result % 1;
return result === result ? (remainder ? result - remainder : result) : 0;
}
toInteger(2.1); // Result: 2
Output code from uglifyjs -b -c -o output.js -- input.js
:
// output.js
function toInteger(value) {
var result = parseFloat(value), remainder = result % 1;
return result === result ? remainder ? result - remainder : result : 0; // Error: Expected: :
}
toInteger(2.1);
I'm aware how edge case this is, but it would be great if there was a compression option to keep the parentheses in for this scenario.
Metadata
Metadata
Assignees
Labels
No labels