Skip to content

Construction

This section contains functions that help with map construction, like creating a map from a list of values, or merging maps.

Compose

Compose creates a map from a list, getting key/value one by one.

Usage:

mapx.Compose("a", 1, "b", 2) // map[any]any{"a": 1, "b": 2}

Merge

Merge merges multiple maps into one.

Usage:

mapx.Merge(  // map[string]int{"a": 1, "b": 3, "c": 4}
	map[string]int{"a": 1, "b": 2},
	map[string]int{"b": 3, "c": 4},
)