Map Functions

map_copy

map_copy(input_map)

Returns a deep copy of the map



Args:

    input_map (dict): the input map



Returns:

    Returns a deep copy of the map. All map values must be primitive types



Examples:

    map_copy({'key1': 'val1', 'key2': 'val2'}) -> {'key1': 'val1', 'key2': 'val2'}

map_create

map_create(list_of_tuples)

Creates a map given a list of 2-tuples, where each tuple is [key, val]



Args:

    list_of_tuples (list): the list of 2-tuple key-value pairs



Returns:

    Returns the created map



Examples:

    map_create(list()) -> {}

    map_create([['key1', 'val1'], ['key2', 'val2']]) -> {'key1': 'val1', 'key2': 'val2'}

map_delete_key

map_delete_key(input_map, key)

Returns the updated map with the removed key



Args:

    input_map (dict): the input map

    key (any): the key to pop from the map



Returns:

    Returns the map with the removed key. No error is thrown if the key does not exist.



Examples:

    map_pop({'key1': 'val1', 'key2': 'val2'}, 'key1') -> {'key2': 'val2'}

map_get

map_get(input_map, key, default=None)

Returns the value associated with a map key, or a default value if not found



Args:

    input_map (dict): the map

    key (any): the lookup key

    default (any): the value to return if key is not in input_map. Defaults to None.



Returns:

    Returns the value associated with a map key, or a default value if not found



Examples:

    map_get({'key1': 'val1', 'key2': 'val2'}, 'key1', default='') -> 'val1'

    map_get({'key1': 'val1'}, 'key10', default='') -> ''

map_keys

map_keys(input_map, sort=false)

Returns the list of keys from the map



Args:

    input_map (dict): the input map

    sort (bool, optional): whether to return the keys in a sorted way



Returns:

    Returns the keys associated with the map



Examples:

    map_keys({'key1': 'val1', 'key2': 'val2'}) -> ['key1', 'key2']

map_update

map_update(input_map, values_to_update)

Updates the map with the provided values.



Args:

    input_map (dict): the input map

    values_to_update (dict): the map with values to update input_map with



Returns:

    Returns updated map



Examples:

    map_update({'key1': 'val1', 'key2': 'val2'}, {'key2': 'newval2'}) -> {'key1': 'val1', 'key2': 'newval2'}

map_values

map_values(input_map, sort=false)

Returns the list of values from the map



Args:

    input_map (dict): the input map

    sort (bool, optional): whether to return a sorted list



Returns:

    Returns the values associated with the map



Examples:

    map_values({'key1': 'val1', 'key2': 'val2'}) -> ['val1', 'val2']