This package has been deprecated

Author message:

Xto6 is now lebab

xto6

1.2.0-alpha • Public • Published

Build Status License JS.ORG

xto6

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 SomeClass = function () {
  console.log('This is the constructor.');
};
 
SomeClass.prototype.someOuterMethod = someFunction;
 
SomeClass.prototype.someInnerMethod = function (birthYear) {
  var result = 'Your Age is : ' + (2015 - birthYear) + ' and you were born in ' + birthYear;
  return result;
};
 
Object.defineProperty(SomeClass.prototype, 'someAccessor', {
  get: function () {
    return this._some;
  },
  set: function (value) {
    this._some = value;
  }
});
 
function someFunction(a, b) {
  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 :

class SomeClass {
  constructor() {
    console.log('This is the constructor.');
  }
 
  someOuterMethod() {
    return someFunction.apply(this, arguments);
  }
 
  someInnerMethod(birthYear) {
    var result = `Your Age is : ${ 2015 - birthYear } and you were born in ${ birthYear }`;
    return result;
  }
 
  get someAccessor() {
    return this._some;
  }
 
  set someAccessor(value) {
    this._some = value;
  }
}
 
function someFunction(a, b) {
  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 and const instead of var
  • Default arguments instead of a = a || 2
  • Function properties in objects to Object methods

Package Sidebar

Install

npm i xto6

Weekly Downloads

1

Version

1.2.0-alpha

License

MIT

Last publish

Collaborators

  • mohebifar