Skip to content

Modification

This section contains functions that modify an existing map.

Keep

Keep keeps only keys that are in the list.

Usage:

mapx.Keep(map[string]int{"a": 1, "b": 2}, "a") // map[string]int{"a": 1}

Delete

Delete removes keys from a map.

Usage:

mapx.Delete(map[string]int{"a": 1, "b": 2}, "a") // map[string]int{"b": 2}