Rich-Harris / butternut

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

`[].slice || ...` generates broken code #54

Closed jbt closed 7 years ago

jbt commented 7 years ago

Looks like [].slice || (...anything) gets replaced with emptystring.

For example: [].slice||1; 1 becomes ,1 (link)

A less contrived example: var slice = [].slice || function() {...}, somethingElse = 1; becomes var slice=,somethingElse=1 (link)

Seems to happen with .slice and other array methods like indexOf, but not for any old property (i.e. [].foo is fine)

Rich-Harris commented 7 years ago

Released 0.4 with the fix, thanks