0.1.1 • Published 8 years ago

babel-plugin-transform-function-to-arrow v0.1.1

Weekly downloads
86
License
MIT
Repository
github
Last release
8 years ago

babel-plugin-transform-function-to-arrow

Transforms functions to arrows and simplifies arrow functions with single return statement

Install

npm install babel-plugin-transform-function-to-arrow

In

const x = function (a, b) { return a + b }
const y = (x) => {
  return Math.sin(x);
}
const z = function () {
  return arguments[0];
}

Out

const x = (a,b) => a+b;
const y = x => Math.sin(x);
const z = function () {
  return arguments[0];
}

Options

  • keep_fnames: Default: false Don't transform functions to arrows for FunctionExpressions with names - Useful for code depending on fn.name.