A case-insensitive, case-preserving string key multi-value map object.

This map supports null values but ignores attempts to add keys with undefined values.

Hierarchy

Constructors

Properties

#mappingNames: string[]

List of mappings to maintain insertion order.

#mappings: Record<string, MultiMapValue>

Mapping of lower-case header names to {key:X, val:[]} values.

Methods

  • Add/replace values on a map.

    Parameters

    • key: string

      the key to change

    • value: any

      the value to add; if undefined then nothing will be added

    • Optional replace: boolean

      if true then replace all existing values; if false append to any existing values

    Returns MultiMap

    this object

  • Add a value.

    This method will append values to existing keys.

    Parameters

    • key: string

      the key to use

    • value: any

      the value to add; if undefined nothing will be added

    Returns MultiMap

  • Test if there are any values associated with a key.

    Parameters

    • key: string

      the key to test

    Returns boolean

    true if there is at least one value associated with the key

  • Get the first avaialble value assocaited with a key.

    Parameters

    • key: string

      the key of the value to get

    Returns any

    the first available value associated with the key, or undefined if not available

  • Get an array of all keys in this map.

    Returns string[]

    array of keys in this map, or an empty array if the map is empty

  • Set a value.

    This method will replace any existing values with just value.

    Parameters

    • key: string

      the key to use

    • value: any

      the value to set; if undefined nothing will be added

    Returns MultiMap

    this object

  • Set multiple values.

    This method will replace any existing values with those provided on values.

    Parameters

    • values: Record<string, any>

      an object who's enumerable properties will be added to this map

    Returns MultiMap

    this object

  • Remove all values associated with a key.

    Parameters

    • key: string

      the key of the values to remove

    Returns undefined | any[]

    the removed values, or undefined if no values were present for the given key

  • Get the values associated with a key.

    Parameters

    • key: string

      the key of the values to get

    Returns undefined | any[]

    the array of values associated with the key, or undefined if not available

Generated using TypeDoc