Babel Closure Elimination
This is a Babel plugin that eliminates unnecessary closures from your JavaScript in the name of performance.
Note: Now requires Babel 6.
What?
Turns code like this:
{ return input;}
Into code like this:
{ return item + 1;} { return item + 2;} { return input;}
Why?
Because it's faster and more memory efficient in most JavaScript engines, and means you can safely use arrow functions without a performance penalty in most cases.
Installation
First, install via npm.
npm install --save-dev babel-plugin-closure-elimination
Then, in your babel configuration (usually in your .babelrc
file), add "closure-elimination"
to your list of plugins:
License
Published by codemix under a permissive MIT License, see LICENSE.md.