> ## 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.

# Invert-Ternary

#### Sourcery rule id: `invert-ternary`

#### Description

Invert ternary operator to remove negation


#### Before

```javascript
const beverage = !too_young ? 'Beer' : 'Juice';
```

#### After

```javascript
const beverage = too_young ? 'Juice': 'Beer';
```



#### Explanation

Negated conditions are more difficult to read than positive ones, so it is best
to avoid them where we can. By inverting the ternary condition and swapping the
expressions we can simplify the code.
