# `Juggernaut.Operators.Helpers`
[🔗](https://github.com/holsee/juggernaut/blob/v0.4.0/lib/juggernaut/operators/helpers.ex#L1)

Building blocks shared by the operator families: operator swaps, table-driven call
renames and literal replacements.

# `kernel_op?`

```elixir
@spec kernel_op?(atom(), arity(), Juggernaut.Mutator.Context.t()) :: boolean()
```

Whether `op/arity` at a site means Kernel's operator (the module does not define it).

# `numeric`

```elixir
@spec numeric(number(), number(), number(), boolean()) :: [{String.t(), Macro.t()}]
```

The numeric literal replacements `value + step`, `value - step` and `zero`, without
duplicates or the value itself; variants `zero`, `succ`, `pred`. With `negated?` the
literal is the operand of a unary minus, so the variants name what happens to the
written value: `-3` → `-4` is `pred`.

# `pairs`

```elixir
@spec pairs([{[module()], [{atom(), atom()}]}]) :: %{
  required({module(), atom()}) =&gt; [atom()]
}
```

A rename table of symmetric pairs: for each `{modules, pairs}` group, each name maps to
the other on every module listed.

# `rename`

```elixir
@spec rename(Macro.t(), Juggernaut.Mutator.Context.t(), map()) :: [{nil, Macro.t()}]
```

Renames a resolved call per `table`: keys are `{module, fun}` (any arity) or
`{module, fun, arity}`, values the new function names. Arguments and the written form
are kept.

# `sentinel`

```elixir
@spec sentinel() :: String.t()
```

The sentinel string replacements use.

# `sigil`

```elixir
@spec sigil(atom(), String.t(), charlist()) :: Macro.t()
```

A sigil node with a delimiter that does not occur in `content`.

# `sigil_content`

```elixir
@spec sigil_content(Macro.t()) :: {:ok, atom(), String.t(), charlist()} | :error
```

The content of a non-interpolated sigil, or `:error`.

# `string`

```elixir
@spec string(String.t()) :: Macro.t()
```

A string literal node.

# `swap`

```elixir
@spec swap(Macro.t(), Juggernaut.Mutator.Context.t(), %{required(atom()) =&gt; [atom()]}) ::
  [
    {String.t(), Macro.t()}
  ]
```

Swaps a binary operator for each operator `table` lists for it; the variant is the new
operator. Operators the module defines itself are left alone.

---

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