google/closure-compiler

Compress condition as logical expression

オープン

#1,842 opened on 2016/06/13

 (3 件のコメント) (0 件のリアクション) (0 人の担当者)Java (1,197 件のフォーク)batch import
enhancementhelp wanted

Repository metrics

Stars
 (7,176 個のスター)
PR merge metrics
 (PR metrics pending)

説明

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!

コントリビューターガイド