@nelsonrc/nrc-phoenix-xml - v1.0.3
    Preparing search index...

    Class Dictionary<K, V>

    Type Parameters

    • K extends string | number | symbol
    • V
    Index

    Constructors

    • Type Parameters

      • K extends string | number | symbol
      • V

      Returns Dictionary<K, V>

    Accessors

    • get size(): number

      Gets the number of entries in the dictionary.

      Returns number

      The count of stored key-value pairs.

    Methods

    • Iterator to allow looping over dictionary entries using for...of.

      Returns IterableIterator<[K, V]>

    • Deletes a key-value pair from the dictionary.

      Parameters

      • key: K

        The key to remove.

      Returns boolean

      true if the key was deleted, otherwise false.

    • Returns an array of key-value pairs.

      Returns [K, V][]

      An array of [key, value] tuples.

    • Retrieves the value associated with a key.

      Parameters

      • key: K

        The key to look up.

      Returns undefined | V

      The value or undefined if not found.

    • Checks if the dictionary contains a specific key.

      Parameters

      • key: K

        The key to check.

      Returns boolean

      true if the key exists, otherwise false.

    • Sets a key-value pair in the dictionary.

      Parameters

      • key: K

        The unique key.

      • value: V

        The associated value.

      Returns void

    • Returns a sorted array of entries based on keys.

      Parameters

      • ascending: boolean = true

        Whether to sort in ascending order (true by default).

      Returns [K, V][]

      A sorted array of [key, value] tuples.

    • Serializes the dictionary into a JSON string.

      Parameters

      • pretty: boolean = false

        Whether to format with indentation (false by default).

      Returns string

      A JSON representation of the dictionary.