babel-plugin-closure-elimination

A Babel plugin which eliminates closures from your JavaScript wherever possible.

  • Owner: codemix/babel-plugin-closure-elimination
  • Platform:
  • License:: MIT License
  • Category::
  • Topic:
  • Like:
    0
      Compare:

Github stars Tracking Chart

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.

Main metrics

Overview
Name With Ownercodemix/babel-plugin-closure-elimination
Primary LanguageJavaScript
Program languageJavaScript (Language Count: 1)
Platform
License:MIT License
所有者活动
Created At2015-05-11 14:08:27
Pushed At2022-12-11 03:00:21
Last Commit At2020-12-13 03:12:24
Release Count22
Last Release Namev1.3.0 (Posted on 2017-10-12 04:32:28)
First Release Name0.0.1 (Posted on )
用户参与
Stargazers Count368
Watchers Count11
Fork Count15
Commits Count115
Has Issues Enabled
Issues Count19
Issue Open Count1
Pull Requests Count14
Pull Requests Open Count3
Pull Requests Close Count2
项目设置
Has Wiki Enabled
Is Archived
Is Fork
Is Locked
Is Mirror
Is Private