This ternary's condition and expression if true are the same, so it can be replaced with an ||. Note that the cases still remain the same (the most notable being if threadInfo.name === '', then the expression if false is still chosen since '' is falsy).
Details
Details
Flow, close reading
Diff Detail
Diff Detail
- Repository
- rCOMM Comm
- Lint
Lint Not Applicable - Unit
Tests Not Applicable
Event Timeline
Comment Actions
Note that the cases still remain the same (the most notable being if threadInfo.name === '', then the expression if false is still chosen since '' is falsy).
Thanks for clarifying this.
return firstLine( threadInfo.name ?? robotextName(threadInfo, viewerID, userInfos), );
wouldn't work because it only cares if the LHS is null or undefined. But, both the ternary and || operator only care about "truthiness." And the empty string is "falsey," so this looks good!