@metreeca/blue - v0.12.0
    Preparing search index...

    Function getOptionBranch

    • Picks the single branch a set-matching option is tested against.

      Routes a ?, ! or + operand to the one branch it is compared with, so that a caller may type the option by that branch. An option is tested by equality and need not be a legal element value. It is matched on its kind alone, ignoring any lexical pattern, so the union is expected to be kind-disjoint. The match stays exactly one, as a conversion commits to a single branch.

      A localised branch takes either a plain string option, matched against the strings of every tag, or a map grouping options by language tag. A null option has no kind and fits every branch, so it routes to a branch only over a single-branch shape.

      Routing applies the same rule as template validation, so every option in a validated template routes to a branch. Stored values route through getStateBranch instead, which never assigns a plain string to a localised branch.

      Type Parameters

      • B extends Shape

        The branch type, carried through from the branches supplied

      Parameters

      • option: unknown

        The option to route, stated singly rather than as the set a filter lists

      • branches: readonly B[]

        The branches to choose among

      Returns Optional<B>

      The sole branch option is tested against, or undefined where it fits none or several