microsoft / ajaxmin

The Microsoft Ajax Minifier enables you to improve the performance of your Ajax applications by reducing the size of your Cascading Style Sheet and JavaScript files.
https://www.nuget.org/packages/AjaxMin
MIT License
33 stars 21 forks source link

Fixed missing parentheses when arrow function has one destructuring parameter #2

Open ghost opened 5 years ago

ghost commented 5 years ago

I discovered this bug when one of my JavaScript files gave a syntax error only in Release mode. There was an arrow function with a single parameter that was also an array destructuring parameter:

([foo, bar]) => console.log(`array[0] = ${foo}, array[1] = ${bar}`)

The destructuring parameter needs to be wrapped in parentheses but the minifier was removing the parentheses.