We all love the goodies that we got from ES6. These were tiny, but surprising features, such as class support, pointer functions, constants, etc.
Modern browsers support most of these syntactic improvements, but Babel has to be used to support legacy browsers. Although there are situations where you can not worry about the support of old browsers
and start living .
It can be some kind of internal project or just server-side JS-code. Let me remind you that the latest stable version of NodeJS
supports ES6 at 99%. In such cases, you can safely write all the code on ES6.
Well, but what about the Legacy? For such cases, Lebab comes to the rescue. This is a program that transforms traditional JavaScript syntax into a brilliant new ES6 syntax. You can install it in npm:
')
npm install -g lebab
You can convert a single file or a list of files from a folder:
$ lebab main.js -o main-es6.js --transform arrow $ lebab --replace 'src/js/**/*.jsx' --transform arrow
Let's try in business:

Sadly, only one type of conversion can be performed from the console at a time. However, you can write a simple
script to correct this situation:
import lebab from 'lebab'; const {code, warnings} = lebab.transform('var f = function(){};', ['let', 'arrow']); console.log(code);
The list of available transformations and their reliability is described in the
documentation .
Do you decide to test Lebab on your own project?