Closed loilo closed 7 years ago
This still occurs with negative numbers.
Input:
(-2).toFixed()
Output Butternut 0.4.6:
(-2)..toFixed()
Output UglifyJS 3.0.8:
(-2).toFixed();
Number
prototypeAs used in Turf.js.
Input:
(-2).toRadians()
Output Butternut 0.4.6:
-2.toRadians()
Output UglifyJS 3.0.8:
(-2).toRadians();
Error from squashing the minified aight source.
Long story short: Butternut rewrites non-decimals to decimals. If there were method calls on the non-decimals (without surrounding parantheses), they will be kept. This leads to invalid syntax.
Input:
Output Butternut:
Output UglifyJS:
EDIT: It's actually not just non-decimals. Numbers in general get their necessary surroundings removed:
Input:
Output Butternut:
Output UglifyJS: