xto6 modernizes your JavaScript code

It helps you to keep your JavaScript codes up-to-date !

Transpile ES5 code into ES6 live !

var Person = function () {
  console.log('This is the constructor.');
};

Person.prototype.getAge = function (birthYear) {
  var age = 2015;
  age -= birthYear;

  return result;
};

Object.defineProperty(Person.prototype, 'age', {
  get: function () {
    return this.getAge();
  }
});

var personsUtils = {
  getName: function (person) {
    return person.firstname + ' ' + person.lastname;
  },
  logInformation: function (person) {
    var message = 'You are ' + person.age;
    console.log(message);
  }
};

setTimeout(function() {
    alert('Having some fun !');
});

Features

Currently xto6 supports these features

  • Function/Prototype to Class
  • String concatenation to Template string
  • Anonymous callbacks to Arrow functions

Road map

These features will be added soon :

  • Convert commonjs module definitions
  • Convert var to let/const
  • For of loops
  • Convert arguments to rest parameters
  • Remove _this=this for arrow functions

Usage

xto6 transpiles your ES5 code to ES6. It does exactly the opposite of what other transpilers do (like babel and traceur).

Install it using npm :

$ npm install -g xto6

Transpile your boring code using the xto6 cli tool.

xto6 es5.js -o es6.js