mirror of
https://github.com/samber/lo.git
synced 2026-04-22 23:47:11 +08:00
1.9 KiB
1.9 KiB
name, slug, sourceRef, category, subCategory, signatures, playUrl, variantHelpers, similarHelpers, position
| name | slug | sourceRef | category | subCategory | signatures | playUrl | variantHelpers | similarHelpers | position | ||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| UnzipByX | unzipbyx | tuples.go#L698 | core | tuple |
|
https://go.dev/play/p/tN8yqaRZz0r |
|
|
40 |
Transforms each input element into a tuple and splits results into parallel slices. Variants support arities from 2 to 9.
Variants: UnzipBy2..UnzipBy9
type User struct{ ID int; Name string }
ids, names := lo.UnzipBy2([]User{{1,"a"},{2,"b"}}, func(u User) (int, string) {
return u.ID, u.Name
})