Takes two maps, creates a copy of the first map, and adds the 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(map1, map2)
returns {key1: value2}
.
Arguments
Arguments
first
The map to be merged into.
second
The map to merge.
Returns
A copy of the first map with items added from the second map.
Raised exceptions
Exceptions
TypeError
If
first
or second
is not a map (dictionary).Examples
Example 1
# Add items from second map to copy of first map # Returns `{"key1": "hello","key2": "world","key3": "good","key4": "morning"}` - init : assign : - my_map1 : { "key1" : "hello" , "key2" : "world" } - my_map2 : { "key3" : "good" , "key4" : "morning" } - returnStep : return : ${map.merge(my_map1, my_map2)}
Example 2
# For same keys in second map, replace values in copy of first map # Returns `{"key1": "good","key2": "morning"}` - init : assign : - my_map1 : { "key1" : "hello" , "key2" : "world" } - my_map2 : { "key1" : "good" , "key2" : "morning" } - returnStep : return : ${map.merge(my_map1, my_map2)}

