mirror of
https://github.com/zoriya/vex.git
synced 2026-05-25 15:40:44 +00:00
10 lines
149 B
Go
10 lines
149 B
Go
package vex
|
|
|
|
func Map[T, U any](ts []T, f func(T, int) U) []U {
|
|
us := make([]U, len(ts))
|
|
for i := range ts {
|
|
us[i] = f(ts[i], i)
|
|
}
|
|
return us
|
|
}
|