JScript transform

This plugin allows Babel to transform named function expressions into function declarations to get around some particularly nasty JScript bugs related to name function expressions.

See particularly nasty JScript bugs.

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

.babelrc

{
  "plugins": ["transform-jscript"]
}

Via CLI

babel --plugins transform-jscript script.js

Via Node API

require("babel-core").transform("code", {
  plugins: ["transform-jscript"]
});