Interface ReadonlyCharMap<T>

Type Parameters

  • T

Hierarchy

Implemented by

Properties

entryCount: number

The number of entires in this map.

This is different from size. In general, you should use size, because it has the same semantics as Set#size and Map#size.

This is equivalent to [...this.entries()].length.

isEmpty: boolean

Returns whether this map is empty.

This is equivalent to this.size === 0 and this.entryCount === 0.

size: number

The number of characters in this map. This is different from entryCount.

This is equivalent to [...this.keys()].reduce((count, range) => count + range.max - range.min + 1, 0).

Methods

  • Returns a new map with all values mapped by the given function.

    If no function is given, the identity function is used.

    Returns CharMap<T>

  • Type Parameters

    • U

    Parameters

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

          • value: T

          Returns U

    Returns CharMap<U>

  • Returns all key-value pairs in the map.

    Entries will be returned in the order of ascending ranges.

    Returns Iterable<[CharRange, T]>

  • Invokes the given callback for every item of the character map.

    This method is implemented more efficiently than other iterator based methods, so chose forEach where every possible.

    Parameters

    Returns void

  • Returns the value associated with the given character of undefined if the character is not key in the map.

    Parameters

    Returns undefined | T

  • Returns whether the given character is a key in the map.

    Parameters

    Returns boolean

  • Returns whether every character in the given range is a key in the map.

    This is equivalent to: [...chars].every(char => this.has(char)).

    Parameters

    Returns boolean

  • Returns whether some character in the given range is a key in the map.

    This is equivalent to: [...chars].some(char => this.has(char)).

    Parameters

    Returns boolean

  • Returns a mapping from the values of this map to its keys.

    Parameters

    Returns Map<T, CharSet>

  • Returns all ranges of characters that are keys in the map.

    Keys will be returned in the same order as this.entries().

    Returns Iterable<CharRange>

  • Returns all values in the map. Values might not be unique if more than one range maps to the same value.

    Values will be returned in the same order as this.entries().

    Returns Iterable<T>