libtmux Reference MCP Search
On this page

selection.Selection

View as Markdown

Module
selection
Package
@libtmux/libtmux
Source
packages/libtmux/src/selection.ts
interface selection.Selection
interface [source]
interface [source]
interface selection.Selection

An immutable, ordered set of tmux objects read at one instant.

A Selection is deliberately not an Array. It is Iterable and it never changes, so the answer it gave a moment ago is still the answer now — which is what lets a snapshot be reasoned about at all. toArray() is the one crossing to array semantics, and everything Array offers that this does not lives on the other side of it.

Two ways to narrow, never overloaded into each other: where takes declarative criteria that are data — serializable, inspectable, sendable over a wire — and filter takes an ordinary predicate. Reach for where unless the question genuinely needs to run code.

12 declared, 0 inherited

Members

  • [Symbol.iterator] method Iterate in tmux's own order.
  • at method The member at index, or undefined when the index is out of range.
  • count method How many members match criteria, or how many there are without it.
  • exists method Whether anything matches. Cheaper to read than comparing a count to zero.
  • filter method Keep the members predicate accepts.
  • first method The first member, or the first matching criteria.
  • map method Apply transform to each member, in order.
  • one method The single member, or the single one matching criteria.
  • oneOrUndefined method The single member, or undefined when there is none.
  • toArray method A plain array of the members, in order.
  • where method Keep the members matching declarative criteria.
  • length property How many members this holds. Unlike count , it takes no criteria.
Esc

Type to search.