Skip to content

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.

Avoid unneeded ternary statements

const foo = a ? a : b;
const foo = a || b;

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.