babel-plugin-closure-elimination

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

  • 所有者: codemix/babel-plugin-closure-elimination
  • 平台:
  • 許可證: MIT License
  • 分類:
  • 主題:
  • 喜歡:
    0
      比較:

Github星跟蹤圖

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.

主要指標

概覽
名稱與所有者codemix/babel-plugin-closure-elimination
主編程語言JavaScript
編程語言JavaScript (語言數: 1)
平台
許可證MIT License
所有者活动
創建於2015-05-11 14:08:27
推送於2022-12-11 03:00:21
最后一次提交2020-12-13 03:12:24
發布數22
最新版本名稱v1.3.0 (發布於 2017-10-12 04:32:28)
第一版名稱0.0.1 (發布於 )
用户参与
星數368
關注者數11
派生數15
提交數115
已啟用問題?
問題數19
打開的問題數1
拉請求數14
打開的拉請求數3
關閉的拉請求數2
项目设置
已啟用Wiki?
已存檔?
是復刻?
已鎖定?
是鏡像?
是私有?