Takes two maps, creates a copy of the first map, and recursively adds items from the second map to the copy.
For maps with the same key, the value from the first map is replaced by the value from the second map.
For example, if you have map1 = {key1: value1}
and map2 = {key1: value2}
, map.merge_nested(map1, map2)
returns {key1: value2}
.
For nested maps, values are merged recursively.
For example, if you have map1 = {key1: {keyx: valuex}}
and map2 = {key1: {keyy: valuey}}
, map.merge_nested(map1, map2)
returns {key1: {keyx: valuex, keyy: valuey}}
.
Arguments
first
second
Returns
A copy of the first map with items added from the second map.
Raised exceptions
TypeError
first
or second
is not a map (dictionary).Examples
# Recursively add items from second map to copy of first map # Returns `{"key1": {"key2": "value2","key3": "value3"}}` - init : assign : - my_map1 : { "key1" : { key2 : value2 }} - my_map2 : { "key1" : { key3 : value3 }} - returnStep : return : ${map.merge_nested(my_map1, my_map2)}

