Options
All
  • Public
  • Public/Protected
  • All
Menu

Enumeration triState

triState enum Extend enum triState to have a parse method

Index

Enumeration members

Functions

Enumeration members

false

false: = 0

false

true

true: = 1

true

unset

unset: = -1

Unset

Functions

Const parse

  • parse(value: string | number, anyCase?: boolean, minValue?: number, maxValue?: number): triState
  • Parses a value to enum of triState

    Parameters

    • value: string | number

      The string or number to convert into enum

    • Default value anyCase: boolean = true

      If true will match an enum value of any case; Otherwise, case must match.

    • Default value minValue: number = -1

      The minimum value that is accepted as a valid enum value.

    • Default value maxValue: number = 1

      The maximum value that is accepted as a valid enum value.

    Returns triState

    The value converted into triState

Const parseLoose

  • parseLoose(value: string | number): triState
  • Parses value in a loose manner to accept input sucs as y, n, yes, no, t, f, true, false, 0, 1

    summary

    Allows of parsing of string, numbers or single char as input. Any value valid for parse is also valid with this method.

    The following list is case insensitive.

    • y or yes = triState.true
    • t or true = triState.true
    • 1= triState.true
    • n or no = triState.false
    • f or false = triState.false
    • 0= triState.false

    Parameters

    • value: string | number

      string or number to parse

    Returns triState

Generated using TypeDoc