I need to use this code and we have problem with ES lint which is give red as rule for the keyword const (I know how to overcome this) but Im not sure that I really understand this code,my question is how it should be written in ES5 (instead of the const since it's getting two param...)
const {code, warnings} = bab.transform('var f = function(){};', ['let', 'arrow']);
I try with var etc without success
i've tried also with babel to do the opposite without success
That's a destructuring assignment. In ES5 it would look like this:
var result = bab.transform('var f = function(){};', ['let', 'arrow']);
var code = result.code;
var warnings = result.warnings;
(Obviously, though, the ES2015 code doesn't have the result
variable.) Or if you want something that doesn't leave the result
variable around:
var code, warnings;
(function() {
var result = bab.transform('var f = function(){};', ['let', 'arrow']);
code = result.code;
warnings = result.warnings;
})();