babel-plugin-minify-simplify

0.5.1 • Public • Published

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"]
});

Versions

Current Tags

VersionDownloads (Last 7 Days)Tag
0.5.1390,196latest
0.6.0-alpha.9148canary

Version History

VersionDownloads (Last 7 Days)Published
0.6.0-alpha.9148
0.5.1390,196
0.5.013,840
0.5.0-alpha.91
0.5.0-alpha.3cc09dcf2
0.5.0-alpha.beb87b9a2
0.5.0-alpha.5a128fd53
0.5.0-alpha.2ed853172
0.5.0-alpha.a24dd0661
0.5.0-alpha.2e0de1712
0.5.0-alpha.89fc69da2
0.5.0-alpha.a28b6b002
0.5.0-alpha.2ec8ff723
0.5.0-alpha.01eac1c31
0.5.0-alpha.5dbc73f73
0.5.0-alpha.830ce3f11
0.5.0-alpha.9e447f6d1
0.5.0-alpha.3b1a8f053
0.5.0-alpha.367cc0481
0.5.0-alpha.36b27d422
0.5.0-alpha.7ba5821f2
0.5.0-alpha.7195fa982
0.5.0-alpha.1cb46b731
0.5.0-alpha.85c9b6d82
0.5.0-alpha.6889f45d1
0.5.0-alpha.91ed36222
0.4.35,237
0.5.0-alpha.b5637c572
0.4.24
0.5.0-alpha.540d75e72
0.5.0-alpha.bce578e21
0.5.0-alpha.18dcfe132
0.5.0-alpha.9939bca93
0.5.0-alpha.5f6018901
0.5.0-alpha.34c3efe91
0.5.0-alpha.9e9864771
0.5.0-alpha.e86a44f11
0.4.18
0.5.0-alpha.e9f96ffe20
0.5.0-alpha.8b9059912
0.5.0-alpha.b42852712
0.5.0-alpha.7b1764631
0.5.0-alpha.552766951
0.5.0-alpha.b5bafaeb2
0.5.0-alpha.72092d202
0.4.04
0.4.0-alpha.caaefb4c1
0.4.0-alpha.f95869d42
0.4.0-alpha.12994a482
0.4.0-alpha.4b14df351
0.4.0-alpha.6546ad111
0.4.0-alpha.15ca1f112
0.3.019,398
0.3.0-alpha.4143a25b2
0.3.0-alpha.71b0b8842
0.3.0-alpha.6ceffb8d1
0.3.0-alpha.636ae2761
0.3.0-alpha.ab81368f4
0.3.0-alpha.ac5762341
0.3.0-alpha.879f25ec1
0.3.0-alpha.5ee3078e2
0.3.0-alpha.8857f1452
0.3.0-alpha.169f87432
0.3.0-alpha.6ae655c02
0.3.0-alpha.d9c99d3f2
0.3.0-alpha.a351eeed1
0.3.0-alpha.cf9a0da22
0.3.0-alpha.e6a189cd3
0.3.0-alpha.670b24ec3
0.3.0-alpha.7f4dc3d42
0.3.0-alpha.033d9ab63
0.3.0-alpha.37064b402
0.3.0-alpha.9a74dfd11
0.3.0-alpha.a74218971
0.3.0-alpha.da60c6b82
0.2.025,517
0.1.25,461
0.1.143
0.1.03
0.0.81,316
0.0.7138
0.0.61,224
0.0.570
0.0.430
0.0.336
0.0.22
0.0.11

Package Sidebar

Install

npm i babel-plugin-minify-simplify

Weekly Downloads

462,813

Version

0.5.1

License

MIT

Unpacked Size

59.8 kB

Total Files

10

Last publish

Collaborators

  • hzoo
  • loganfsmyth
  • nicolo-ribaudo