Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

babel-plugin-closure-elimination

Package Overview
Dependencies
Maintainers
3
Versions
24
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

babel-plugin-closure-elimination

Removes closures from your JavaScript in the name of performance.

  • 1.3.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
225
decreased by-43.61%
Maintainers
3
Weekly downloads
 
Created
Source

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.

Keywords

FAQs

Package last updated on 25 Aug 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc