@empathyco/x-components
Version:
Empathy X Components
73 lines (34 loc) • 1.18 kB
Markdown
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) > [@empathyco/x-components](./x-components.md) > [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)<!-- --><Payload>
</td><td>
The wire to filter.
</td></tr>
<tr><td>
filterFn
</td><td>
(parameters: [WireParams](./x-components.wireparams.md)<!-- --><Payload>) => 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)<!-- --><Payload>
The Wire function filter.