Skip to content

Commit

Permalink
Tweak simpify README [skip ci]
Browse files Browse the repository at this point in the history
  • Loading branch information
existentialism committed Dec 4, 2016
1 parent a0922fc commit 6320550
Showing 1 changed file with 36 additions and 32 deletions.
68 changes: 36 additions & 32 deletions packages/babel-plugin-minify-simplify/README.md
Expand Up @@ -4,42 +4,46 @@ This plugin will transform code in mainly two ways:

1. Reduce as much statements as possible into expressions

**In**
```js
function foo() {
if (x) a();
}
function foo2() {
if (x) a();
else b();
}
```

**Out**
```js
function foo() {
x && a();
}
function foo2() {
x ? a() : b();
}
```
**In**

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

**Out**

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

2. Make expressions as uniform as possible for better compressibility

**In**
```js
undefined
foo['bar']
Number(foo)
```
**In**

**Out**
```js
void 0
foo.bar
+foo
```
```js
undefined
foo['bar']
Number(foo)
```

**Out**

```js
void 0
foo.bar
+foo
```


## Installation
Expand Down

0 comments on commit 6320550

Please sign in to comment.