Rich-Harris / butternut

The fast, future-friendly minifier
https://butternut.now.sh
MIT License
1.17k stars 17 forks source link

Optimise assignments in if blocks #11

Open Rich-Harris opened 7 years ago

Rich-Harris commented 7 years ago
// input
if ( a ) {
  obj = {}
} else {
  obj = null;
}

// ideal
obj=a?{}:null

// actual
a?(obj={}):(obj=null)

Uglify and Closure both get to the ideal version.