Skip to content

Simplify-Ternary

Sourcery rule id: simplify-ternary

Description

Avoid unneeded ternary statements

Before

const foo = a ? a : b;

After

const foo = a || b;

Explanation

It is possible to simplify certain ternary statements into either use of an || or !. This makes the code easier to read, since there is no conditional logic.