xto6
xto6 transpiles your ES5 code to ES6. It does exactly the opposite of what other transpilers do (like babel and traceur)! If you want to understand what xto6 exactly does, try the live demo.
Why?
Still coding this way? Think twice!
var { console;}; SomeClassprototypesomeOuterMethod = someFunction; SomeClassprototype { var result = 'Your Age is : ' + 2015 - birthYear + ' and you were born in ' + birthYear; return result;}; Object; { return a + b;}
Usage
Install it using npm :
$ npm install -g xto6
Transpile your old-fashioned code using the xto6
cli tool.
xto6 es5.js -o es6.js
And the result for the code above is :
{ console; } { return someFunction; } { var result = `Your Age is : and you were born in `; return result; } { return this_some; } { this_some = value; } { return a + b;}
Want to convert your whole project to ES6 syntax for even greater awesomeness? No problem!
$ find . -type f -not -path "*node_modules*" -name "*.js" -print0 | xargs -0 -I % xto6 % -o %
Supported Features
- Function/Prototypes to Classes
- Callback to Arrow functions
- String concatenation to Template Strings
- Using
let
andconst
instead ofvar
- Default arguments instead of
a = a || 2
- Function properties in objects to Object methods