babel/packages/babel-plugin-transform-es2015-block-scoped-functions
2017-09-26 11:14:41 -04:00
..
2017-06-27 12:15:00 -05:00
2017-03-25 21:46:16 -04:00
2017-09-26 11:14:41 -04:00

babel-plugin-transform-es2015-block-scoped-functions

Babel plugin to ensure function declarations at the block level are block scoped.

Examples

In

{
  function name (n) {
    return n;
  }
}

name("Steve");

Out

{
  var _name = function _name(n) {
    return n;
  };
}

name("Steve");

Installation

npm install --save-dev babel-plugin-transform-es2015-block-scoped-functions

Usage

.babelrc

{
  "plugins": ["transform-es2015-block-scoped-functions"]
}

Via CLI

babel --plugins transform-es2015-block-scoped-functions script.js

Via Node API

require("babel-core").transform("code", {
  plugins: ["transform-es2015-block-scoped-functions"]
});