# `Mutare.Mutators.IfCondition`
[🔗](https://github.com/foxbenjaminfox/mutare/blob/v0.2.1/lib/mutare/mutators/if_condition.ex#L1)

Replaces each eligible `if`, `unless`, and `cond` condition with `true` and `false`.

This family handles conditions whose boolean role comes from their position, such as `if user`, `if valid?(value)`, or `if Map.has_key?(map, key)`. Boolean operators are excluded because `Mutare.Mutators.Conditional` already produces the same constant replacements.

Literal `true`, `false`, and `nil` conditions are also excluded.

A binding condition requires special handling because its bindings may be used in the branch body. Bindings in `if` and `unless` conditions are hoisted before the condition is mutated. A binding condition in `cond` is not mutated.

This family is enabled by default and uses the `if_condition` ignore name.

# `condition_replacements`

```elixir
@spec condition_replacements(Macro.t()) :: [Macro.t()]
```

Returns clean-meta `true` and `false` replacements for an eligible condition.

Returns `[]` for boolean operators handled by `Mutare.Mutators.Conditional`,
literal boolean or `nil` conditions, and binding nodes. The transform may hoist
bindings from `if` and `unless` before calling this callback.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
