Original PR: https://github.com/babel/babel/pull/2469. Seems this got lost in the v6 changes. - - - Without this, the only way to replace the arrow function is to either manually override its `node.body`, or duplicate the arrow: ```js // Old ArrowFunctionExpression: function (node) { node.body = t.blockStatement(...); // Or return t.ArrowFunctionExpression( node.params, t.blockStatement(...), node.async ); } // New ArrowFunctionExpression: function() { this.get("body").replaceWith(t.blockStatement(...)); } ```
babel-core
Babel compiler core.
Install
$ npm install babel-core
Usage
import babel from 'babel-core';
const code = `class Example {}`;
const result = babel.transform(code, { /* options */ });
result.code; // Generated code
result.map; // Sourcemap
result.ast; // AST
For more in depth documentation see: http://babeljs.io/docs/usage/api/