Simplify-Ternary
Documentation Index
Fetch the complete documentation index at: https://docs.sourcery.ai/llms.txt
Use this file to discover all available pages before exploring further.
Sourcery rule id: simplify-ternary
Section titled “Sourcery rule id: simplify-ternary”Description
Section titled “Description”Avoid unneeded ternary statements
Before
Section titled “Before”const foo = a ? a : b;const foo = a || b;Explanation
Section titled “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.