Back to Lo

Core Invert

docs/data/core-invert.md

1.53.0191 B
Original Source

Creates a map with keys and values swapped. If values are duplicated, later keys overwrite earlier ones.

go
lo.Invert(map[string]int{"a": 1, "b": 2})
// map[int]string{1: "a", 2: "b"}