babel-plugin-closure-elimination
Removes closures from your JavaScript in the name of performance.
Last updated 6 years ago by gvozd .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install babel-plugin-closure-elimination 
SYNC missed versions from official npm registry.

Babel Closure Elimination

This is a Babel plugin that eliminates unnecessary closures from your JavaScript in the name of performance.

Build Status

Note: Now requires Babel 6.

What?

Turns code like this:

function demo (input) {
  return input.map(item => item + 1).map(item => item + 2);
}

Into code like this:

function _ref(item) {
  return item + 1;
}

function _ref2(item) {
  return item + 2;
}

function demo(input) {
  return input.map(_ref).map(_ref2);
}

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:

{
  "plugins": ["closure-elimination"]
}

License

Published by codemix under a permissive MIT License, see LICENSE.md.

Current Tags

  • 1.3.2                                ...           latest (6 years ago)

24 Versions

  • 1.3.2                                ...           6 years ago
  • 1.3.1                                ...           6 years ago
  • 1.3.0                                ...           9 years ago
  • 1.2.1                                ...           9 years ago
  • 1.2.0                                ...           9 years ago
  • 1.1.16                                ...           9 years ago
  • 1.1.15                                ...           9 years ago
  • 1.1.14                                ...           9 years ago
  • 1.1.13                                ...           9 years ago
  • 1.1.12                                ...           9 years ago
  • 1.1.11                                ...           9 years ago
  • 1.1.8                                ...           9 years ago
  • 1.1.7                                ...           9 years ago
  • 1.1.6                                ...           9 years ago
  • 1.1.5                                ...           9 years ago
  • 1.1.0                                ...           9 years ago
  • 1.0.6                                ...           10 years ago
  • 1.0.5                                ...           10 years ago
  • 1.0.4                                ...           10 years ago
  • 1.0.3                                ...           10 years ago
  • 1.0.1                                ...           10 years ago
  • 1.0.0                                ...           10 years ago
  • 0.0.2                                ...           11 years ago
  • 0.0.1                                ...           11 years ago
Maintainers (2)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 24
Dependencies (0)
None
Dependents (2)

Copyright 2013 - present © cnpmjs.org | Home |