Represents a text string encoded according the Normalization Form Canonical Composition Unicode Equivalence.

Hierarchy (view full)

Implements

Constructors

Accessors

Methods

Constructors

  • Protected

    Creates a new instance of this class representing the exp string normalized according the Canonical Composition Form Unicode Equivalence.

    Parameters

    • exp: string

      The expression to be passed to the constructor.

    Returns Txt

Accessors

  • get bi(): bigint
  • Converts the current Txt string to a BigInt.

    Returns bigint

    The BigInt representation of the Txt string.

    If the conversion to BigInt fails because this Txt string doesn't represent an integer.

  • get bytes(): Uint8Array
  • Converts the current Txt string to a buffer of bytes.

    Returns Uint8Array

    The bytes representation of the Txt string.

  • get n(): number
  • Converts the current Txt string to a number.

    Returns number

    The numeric value of the Txt string.

    If the conversion to number fails because this Txt string doesn't represent a decimal number.

Methods

  • Compares the current instance to another instance of Txt.

    Parameters

    • that: Txt

      The instance to compare with.

    Returns number

    • A negative number if the current instance is less than the specified instance, zero if they are equal, or a positive number if the current instance is greater.
  • Returns a string representation of the object.

    Returns string

    A string representation of the object.

  • Creates a new Txt instance from the provided expression.

    Parameters

    • exp:
          | string
          | number
          | bigint
          | Uint8Array

      The expression to convert to Txt:

      • bigint is represented as a NFC encoded string expressing the value in base 10;
      • number is represented as a NFC encoded string expressing the value in base 10;
      • string is encoded as NFC string;
      • Uint8Array is NFC decoded to a string.

    Returns Txt

    • A new Txt instance.