Back to Lo

Core Haskey

docs/data/core-haskey.md

1.53.0202 B
Original Source

Returns whether the given key exists in the map.

go
exists := lo.HasKey(map[string]int{"foo": 1, "bar": 2}, "foo")
// true

exists = lo.HasKey(map[string]int{"foo": 1, "bar": 2}, "baz")
// false