# selection.Selection.filter

- **Module:** selection.Selection
- **Package:** @libtmux/libtmux
- **Language:** TypeScript
- **Kind:** method
- **Source:** https://github.com/libtmux/libtmux-ts/blob/2cb93308200da38a26b59876618116850f110607/packages/libtmux/src/selection.ts#L403
- **Page:** https://libtmux.org/reference/ts/selection-selection-filter/

```
selection.Selection.filter(predicate: : (value: Model, index: number, values: readonly Model[]) => value is Narrowed, thisArg: : unknown) -> Selection<Narrowed>
```

Keep the members `predicate` accepts.

For a question that has to run code. When the question can be expressed as
criteria, `where` says the same thing as data — which can be logged, sent
to another process, or stored.

## Example

```ts
snapshot.panes.filter((entry) => entry.currentCommand?.startsWith("v") === true);
```
