How De Morgan's laws are applied to code
mainThe plugin transforms negated boolean expressions to improve clarity and reduce errors.
Example 1: Negated Conjunction
- Before:
if (!(a && b)) - After:
if (!a || !b)
Example 2: Complex Negated Disjunction
- Before:
if (!(a || !b || c >= 10 || d !== e)) - After:
if (!a && b && !(c >= 10) && d === e)
// Before
if (!(a && b)) {
/* ... */
}
// After
if (!a || !b) {
/* ... */
}