Skip to main content

Description

Performs a shallow merge of multiple maps into a new map. When keys conflict, values from later maps override earlier ones. Non-object inputs are ignored.

Syntax

Parameters

Returns

Type: map (object) A new map containing all keys and values from the input maps. Later maps override earlier ones for duplicate keys.

Examples

Example 1: Basic Merge

Output:
(Note: b from map2 overrides b from map1)

Example 2: Merging Node Properties

Example 3: Combining Configuration

Output:

Example 4: Merging Multiple Maps

Notes

  • Non-object inputs are silently ignored
  • Performs shallow merge (nested objects are not deeply merged)
  • Later maps take precedence for duplicate keys
  • Returns a new map; does not modify input maps
  • Useful for applying defaults, combining configuration, or merging properties

See Also

Frequently Asked Questions

It performs a shallow merge. Nested maps are not recursively merged — values from later maps overwrite those from earlier maps.
Yes. You can pass multiple maps as arguments to merge them all in sequence.