3 ms·
You can set babel to `loose` mode to avoid having the transpiled output use `Symbol`. What I would love though is a "super-loose" mode which takes for-of and tr
by bluepnume 9y ago
You can set babel to `loose` mode to avoid having the transpiled output use `Symbol`. What I would love though is a "super-loose" mode which takes for-of and transpiles it directly to for-in -- i.e. excluding any support for iterators and just functioning on indexable collections with a defined `.length`. That would be enough to get concise output in most cases if you're confident you're always iterating over static collections.
- always_good 9y agofor..of works with any iterator which is essentially the interface { next() }, thus arbitrary. If you limit it to only indexable things, then I'm not sure why you would make it a point to use for..of.
- hzoo 9y agoI answered this on twitter: https://twitter.com/left_pad/status/936721918840983554 https://twitter.com/left_pad/status/936721918840983554 And added this option + optimization for v7 https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-for-of#assumearray https://github.com/babel/babel/tree/master/packages/babel-pl... so can look forward to that now =D.