Back to Lo

Core Fromentries

docs/data/core-fromentries.md

1.53.0202 B
Original Source

Transforms a slice of key/value pairs into a map.

go
m := lo.FromEntries([]lo.Entry[string, int]{
    {Key: "foo", Value: 1},
    {Key: "bar", Value: 2},
})
// map[string]int{"foo": 1, "bar": 2}