On this page
selection.Selection
- Module
- selection
- Package
- @libtmux/libtmux
- Source
- packages/libtmux/src/selection.ts
-
An immutable, ordered set of tmux objects read at one instant.
A Selection is deliberately not an Array. It is
Iterableand 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:
wheretakes declarative criteria that are data — serializable, inspectable, sendable over a wire — andfiltertakes an ordinary predicate. Reach forwhereunless 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
predicateaccepts. - first method The first member, or the first matching
criteria. - map method Apply
transformto 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.