Rich-Harris / butternut

The fast, future-friendly minifier

Home Page:https://butternut.now.sh

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Bug: Butternut removes meaningful parantheses inside for loop heads

loilo opened this issue · comments

From squashing chess.js

Butternut removes crucial parantheses around (a in b) expressions inside for loop heads. Without those, JavaScript tries to interpret the for loop as a for ... in loop.

Input:

for (var any_value = ("key" in any_object); any_condition;) {
  any_fn()
}

Output Butternut 0.4.6:

for(var any_value="key" in any_object;any_condition;)any_fn()

Output UglifyJS 3.0.8:

for(var any_value=("key"in any_object);any_condition;)any_fn();