# selection.Selection.oneOrUndefined

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

```
selection.Selection.oneOrUndefined(criteria: : WhereOf<Model>) -> Model | undefined
```

The single member, or undefined when there is none.

`one` without the empty case: several still throws, because that says the
criteria were wrong rather than that the answer is absent.

## Example

```ts
snapshot.sessions.oneOrUndefined({ name: "work" })?.id;
```
