google / google/closure-compiler

Compress condition as logical expression

Open
#1,842 3 comments 0 reactions 0 assignees View on GitHub
enhancement help wanted
Dominant language
JavaScript
Stars
7.7k
Forks
1.2k
Avg merge
2d 12h
Merged PRs (30d)
6

Description

Hi,

I wonder if it's possible to shrink an expression like

``` js
if (!a)
c = b;
else
c =a;
```

to

``` js
c = a || b;
```

instead of

``` js
c = a ? a : b;
```

You do such tricks already in a logical manner to kick out if-statements, but it would make sense within expressions as well. Or do I miss something, that it should be avoided?

Thanks!

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.