Class: HostMap

HostMap

Constructor

new HostMap()

Represents an associative-array of hosts that can be iterated. It creates an internal copy when adding or removing, making it safe to iterate using the values() method within async operations.

Methods

get(key) → {Host}

Gets a host by key or undefined if not found.
Parameters:
Name Type Description
key String
Returns:
Type
Host

keys() → {Array.<String>}

Returns an array of host addresses.
Returns:
Type
Array.<String>

remove(key)

Removes an item from the map.
Parameters:
Name Type Description
key String The key of the host

removeMultiple(keys)

Removes multiple hosts from the map.
Parameters:
Name Type Description
keys Array.<String>

set()

Adds a new item to the map.

values() → {Array.<Host>}

Returns a shallow copy of the values of the map.
Returns:
Type
Array.<Host>