@babel/plugin-transform-block-scoped-functions
Examples
In
{
function name (n) {
return n;
}
}
name("Steve");
Out
{
let name = function (n) {
return n;
};
}
name("Steve");
Installation
npm install --save-dev @babel/plugin-transform-block-scoped-functions
Usage
Via .babelrc (Recommended)
.babelrc
{
"plugins": ["@babel/plugin-transform-block-scoped-functions"]
}
Via CLI
babel --plugins @babel/plugin-transform-block-scoped-functions script.js
Via Node API
require("@babel/core").transform("code", {
plugins: ["@babel/plugin-transform-block-scoped-functions"]
});