# `Juggernaut.Operator`
[🔗](https://github.com/holsee/juggernaut/blob/v0.4.0/lib/juggernaut/operator.ex#L1)

The behaviour of an operator family (design notes §8.1).

A family is offered every site the walk reaches in one of its `c:positions/0` and
returns the replacements it makes there, each with its variant label (or `nil` for a
family without labels). Replacements are Sourceror AST; they reuse the original
operands so that the rendered mutant stays small.

`use Juggernaut.Operator, name: :relational, positions: [:runtime, :guard], variants: [...]`
defines `name/0`, `category/0` (from `Juggernaut.Operators.Catalog`), `positions/0` and
`variants/0`; the module implements `c:mutate/2`.

# `position`

```elixir
@type position() :: :runtime | :pattern | :guard
```

# `replacement`

```elixir
@type replacement() :: {String.t() | nil, Macro.t()}
```

# `category`

```elixir
@callback category() :: atom()
```

The family's category.

# `mutate`

```elixir
@callback mutate(node :: Macro.t(), ctx :: Juggernaut.Mutator.Context.t()) :: [
  replacement()
]
```

The replacements this family makes at `node`, or `[]`.

# `name`

```elixir
@callback name() :: atom()
```

The family name, as `Juggernaut.Operators.Catalog` lists it.

# `positions`

```elixir
@callback positions() :: [position()]
```

The positions this family mutates.

# `variants`

```elixir
@callback variants() :: [String.t()]
```

The variant labels an ignore filter may name (`family:label`).

---

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