# selection.Selection.filter

- **Module:** selection.Selection
- **Package:** libtmux
- **Language:** TypeScript
- **Kind:** method
- **Source:** https://github.com/libtmux/libtmux-ts/blob/3fe1ca654b81b8cbf4a13b777a001a3298c87a6f/packages/libtmux/src/selection.ts#L409
- **Page:** https://libtmux.org/en/ts/latest/reference/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);
```
