mirror of
https://github.com/samber/lo.git
synced 2026-04-22 15:37:14 +08:00
fa095e4b4f
* fix(doc): fix go playground demo URL * fix(doc): add more go playground demo URL
691 B
691 B
name, slug, sourceRef, category, subCategory, playUrl, variantHelpers, similarHelpers, position, signatures
| name | slug | sourceRef | category | subCategory | playUrl | variantHelpers | similarHelpers | position | signatures | |||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| MapToSlice | maptoslice | map.go#L367 | core | map | https://go.dev/play/p/4f5hbHyMf5h |
|
|
210 |
|
Transforms a map into a slice by applying an predicate to each key/value pair.
m := map[int]int64{1:4, 2:5, 3:6}
s := lo.MapToSlice(m, func(k int, v int64) string {
return fmt.Sprintf("%d_%d", k, v)
})
// []string{"1_4", "2_5", "3_6"}