Class UnicodeSet

A mathematical set of characters and strings.

Despite the name, the characters in this set are not necessarily Unicode characters. So chars.maximum is not necessarily 0x10FFFF.

The set is represented as a union of a CharSet and a StringSet.

Hierarchy

  • UnicodeSet

Properties

accept: StringSet

A sorted set of words.

In addition to the usual guarantees of StringSet, this set is also guaranteed to not contain any single-character words.

chars: CharSet

All single characters in the set.

Accessors

  • get hasEmptyWord(): boolean
  • true if the set contains the empty word.

    This is equivalent to this.accept.hasEmptyWord.

    Returns boolean

  • get isEmpty(): boolean
  • true if the set is empty (=accepts no words).

    Returns boolean

  • get maximum(): Char
  • The maximum character in the set.

    This is equivalent to this.chars.maximum.

    Returns Char

  • get wordSets(): readonly ReadonlyWordSet[]
  • All word sets accepted by this set.

    Word sets are guaranteed to be sorted by descending length and code points. This means that word sets are in the order in which the ECMAScript RegExp engine would try matching them.

    Note: This is a lazy getter. Try to avoid calling it for best performance.

    Returns readonly ReadonlyWordSet[]

Methods

  • Returns the minimum and maximum length of words in this set.

    If this set is empty, undefined will be returned returned.

    Returns undefined | {
        max: number;
        min: number;
    }