@zthun/trilean
    Preparing search index...

    Class ZTrileanAbstract

    A utility class for trilean values.

    Index

    Constructors

    Properties

    Indeterminate: "indeterminate"

    A constant value that represents an indeterminate value.

    Methods

    • Converts from a value to a trilean value.

      This is similar to parse, but it also supports non string inputs which will be converted to a boolean.

      Parameters

      • val: any

        The value to convert.

      • fallback: trilean = false

        The fallback value in the case that val cannot be converted. This will only be used in the case that val is a string, null, or undefined.

      Returns trilean

      The trilean value of val. If val is null or undefined, then fallback is returned. If val is a string, then the return value of parse will be used. If val is a boolean, then it will be directly returned. If val is equal to Indeterminate, then Indeterminate will be returned. Otherwise, the truthy nature of value will be returned.

    • Gets a value that determines if val is a trilean supported value.

      Parameters

      • val: any

        The value to test.

      Returns val is trilean

      True if val is a trilean value. False otherwise.

    • Gets whether val is the indeterminate value.

      Parameters

      Returns val is "indeterminate"

    • Converts a string to a trilean value.

      Parameters

      • str: undefined | null | string

        The text to parse.

      • fallback: trilean = false

        The fallback in the case that str is not a parsable value.

      Returns trilean

      The parsed trilean value or fallback if str is not a valid trilean value.

    • Converts a trilean value to a string.

      Parameters

      Returns string

      A string of true if x is true, false if x is false, and indeterminate if x is the indeterminate symbol.