Files
lo/docs/data/core-keyify.md
T
Samuel Berthe fa095e4b4f fix(doc): fix go playground demo URL (#832)
* fix(doc): fix go playground demo URL

* fix(doc): add more go playground demo URL
2026-03-06 00:09:59 +01:00

552 B

name, slug, sourceRef, category, subCategory, playUrl, variantHelpers, similarHelpers, position, signatures
name slug sourceRef category subCategory playUrl variantHelpers similarHelpers position signatures
Keyify keyify slice.go#L429 core slice https://go.dev/play/p/_d5lXdzfw32
core#slice#keyify
core#slice#keyby
core#slice#uniq
core#slice#uniqby
core#slice#groupby
270
func Keyify[T comparable, Slice ~[]T](collection Slice) map[T]struct{}

Returns a set-like map where each unique element of the slice is a key.

set := lo.Keyify([]int{1, 1, 2, 3, 4})
// map[int]struct{}{1: {}, 2: {}, 3: {}, 4: {}}