(Starting point - this excellent article)
Quick notes:
npm install -g babel
followed bybabel -d <targetdir> <sourcedir>
to transpilenpm
has ascripts.prepublish
that runs a command before publishing. Definingscripts.compile
as the command above in #1 and usingnpm run compile
asscripts.prepublish
automatically transpiles before publishing- Add
babel
underdevDependencies
so that npm will add thebabel
executable to the path before running any scripts (in particular,scripts.prepublish
as described above) - You'll need
npm install core-js
for additional features likeMap
,Set
andString.prototype.repeat
see ES6 Features
- Arrows (as MapReduce)
- Spread Arguments (I wish you could put them before a single argument, e.g.
(...args, callback)
) - Better Object (the ability to have dynamic keys with
[ <some expression> ] : <some value>
is very convenient) - Destructure (it's interesting how
{go: here, also: there} => { go: 'one', also: 'two'}
assignshere
andthere
) - Iterators (these are seriously powerful, but you'd need to think hard for a use case. Generators are a subset of iterators)
- Person (classes... meh...)
- Map, Set, WeakMap, WeakSet
- Proxies
- Symbols
- Subclassable Built-Ins
- Math + Number + String + Object APIs
- Binary and Octal Literals
- Promises
- Reflect (???)
- Tail Call Optimization (unsupported, sadly)