google/closure-compiler

Compress condition as logical expression

Offen

#1.842 geöffnet am 13.06.2016

 (3 Kommentare) (0 Reaktionen) (0 zugewiesene Personen)Java (1.197 Forks)batch import
enhancementhelp wanted

Repository-Metriken

Stars
 (7.176 Sterne)
PR-Merge-Metriken
 (PR-Metriken ausstehend)

Beschreibung

Hi,

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

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

to

c = a || b;

instead of

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