# tmux_filter:new/2

- **Package:** libtmux_erlang
- **Language:** Erlang
- **Kind:** function
- **Source:** https://github.com/libtmux/libtmux-erlang/blob/d1b6308440cf9eb8f6647e7ae434bce60e849368/apps/libtmux_erlang/src/tmux_filter.erl#L75
- **Page:** https://libtmux.org/en/erlang/latest/reference/tmux_filter-new-2/

```
new/2
-spec new(tmux_schema:entity(), map() | t()) ->
             {ok, t()} | {error, map()}.
```

Validate criteria or reuse an already normalized filter for the same entity.

## Examples

```erlang
1> {ok, F} = tmux_filter:new(pane, #{width => #{gte => 120.0}}), ok.
ok
2> tmux_filter:new(pane, F) =:= {ok, F}.
true
3> tmux_filter:new(pane, #{active => #{contains => <<"yes">>}}).
{error,#{code => unsupported_operator,path => [active,contains],allowed => [equals,'not',in,not_in]}}
```

## Parameters

- `Entity` (`tmux_schema:entity()`)
- `Filter` (`map() | t()`)
