Options
All
  • Public
  • Public/Protected
  • All
Menu

Reprensents an fswitch tree. Allows chaining conditions to the fswtich.

Type parameters

  • T

    The type of the value that will be matched against each condition.

  • U

    The type of the value returned from the callback of the matched condition.

Hierarchy

  • Switch

Index

Properties

Properties

default

default: (callback: (value: T) => U) => SwitchResult<U>

Adds a default case to the fswitch tree to be executed when no other case is matched.

param

Executed if the default case is matched.

Type declaration

    • Parameters

      • callback: (value: T) => U
          • (value: T): U
          • Parameters

            • value: T

            Returns U

      Returns SwitchResult<U>

when

when: (condition: T | Array<T> | SwitchConditionEvaluater<T>, callback: (value: T) => U) => Switch<T, U>

Adds a new case to the fswitch tree.

param

Indicates whether this case should be matched and the @callback executed.

param

Executed if the @condition evaluates to true.

Type declaration

    • (condition: T | Array<T> | SwitchConditionEvaluater<T>, callback: (value: T) => U): Switch<T, U>
    • Parameters

      • condition: T | Array<T> | SwitchConditionEvaluater<T>
      • callback: (value: T) => U
          • (value: T): U
          • Parameters

            • value: T

            Returns U

      Returns Switch<T, U>

Legend

  • Property

Generated using TypeDoc