butternut
butternut copied to clipboard
Optimise assignments in if blocks
// 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.