2
0
mirror of https://github.com/frappe/frappe_docker.git synced 2025-02-04 13:08:26 +00:00
frappe_docker/frappe-bench/node_modules/babel-plugin-minify-simplify
2017-07-31 15:51:51 +05:30
..
2017-07-31 15:51:51 +05:30
2017-07-31 15:51:51 +05:30
2017-07-31 15:51:51 +05:30
2017-07-31 15:51:51 +05:30

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

Usage

.babelrc

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

Via CLI

babel --plugins minify-simplify script.js

Via Node API

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