@babel/plugin-transform-jscript
Example
In
var foo = function bar() {
};
Out
"use strict";
var foo = (function () {
function bar() {}
return bar;
})();
Installation
npm install --save-dev @babel/plugin-transform-jscript
Usage
Via .babelrc (Recommended)
.babelrc
{
"plugins": ["@babel/plugin-transform-jscript"]
}
Via CLI
babel --plugins @babel/plugin-transform-jscript script.js
Via Node API
require("@babel/core").transform("code", {
plugins: ["@babel/plugin-transform-jscript"]
});