This is a colection of macros which implement the new syntactic changes in ES6 (Harmony) while allowing you to compile them down to ES5 code using sweet.js. This will allow you to get familiar with writing ES6 code before all (or most) browsers implement them.
Licensed under the MIT license.
A short introduction can be found here. For using sweet.js in the browser, there is an API available for compiling sjs files here.
Sweet.js will generate some pretty ugly identifiers so if this is a problem for the sjs-generated JavaScript, then compile with the --readable-names flag. Keep in mind this only supports ES5 code.
Currently the following ES6 syntax is implemented:
- Default parameters
- Arrow functions
- Classes
- Object literals (Experimental -- does not fully work properly since sweet.js doesn't fire callback functions for manipulating delimiters including braces.)
You can find my blog article which discusses the process of adding new features in-depth here.