<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [@empathyco/x-components](./x-components.md) &gt; [filter](./x-components.filter.md)

## filter() function

Creates a [Wire](./x-components.wire.md) that is only executed whenever the condition in the filterFn is true.

**Signature:**

```typescript
export declare function filter<Payload>(wire: Wire<Payload>, filterFn: (parameters: WireParams<Payload>) => boolean): Wire<Payload>;
```

## Parameters

<table><thead><tr><th>

Parameter


</th><th>

Type


</th><th>

Description


</th></tr></thead>
<tbody><tr><td>

wire


</td><td>

[Wire](./x-components.wire.md)<!-- -->&lt;Payload&gt;


</td><td>

The wire to filter.


</td></tr>
<tr><td>

filterFn


</td><td>

(parameters: [WireParams](./x-components.wireparams.md)<!-- -->&lt;Payload&gt;) =&gt; boolean


</td><td>

A function which must return a boolean and that will be executed every time the wire is called.


</td></tr>
</tbody></table>

**Returns:**

[Wire](./x-components.wire.md)<!-- -->&lt;Payload&gt;

The Wire function filter.

