babel-plugin-minify-simplify
> Simplifies code for minification by reducing statements into expressions and making expressions uniform where possible.
Last updated 6 years ago by hzoo .
MIT · Repository · Bugs · Original npm
$ cnpm install babel-plugin-minify-simplify 
SYNC missed versions from official npm registry.

babel-plugin-minify-simplify

Simplifies code for minification by reducing statements into expressions and making expressions uniform where possible.

Example

Reduce statement into expression

In

function foo() {
  if (x) a();
}
function foo2() {
  if (x) a();
  else b();
}

Out

function foo() {
  x && a();
}
function foo2() {
  x ? a() : b();
}

Make expression as uniform as possible for better compressibility

In

undefined
foo['bar']
Number(foo)

Out

void 0
foo.bar
+foo

Installation

npm install babel-plugin-minify-simplify --save-dev

Usage

Via .babelrc (Recommended)

.babelrc

{
  "plugins": ["minify-simplify"]
}

Via CLI

babel --plugins minify-simplify script.js

Via Node API

require("@babel/core").transform("code", {
  plugins: ["minify-simplify"]
});

Current Tags

  • 0.5.1                                ...           latest (6 years ago)

2 Versions

  • 0.6.0-alpha.9                                ...           6 years ago
  • 0.5.1                                ...           6 years ago
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dev Dependencies (0)
None
Dependents (0)
None

Copyright 2013 - present © cnpmjs.org