10 lines
143 B
Go
10 lines
143 B
Go
|
package utils
|
||
|
|
||
|
func Map[T, U any](ts []T, f func(T) U) []U {
|
||
|
us := make([]U, len(ts))
|
||
|
for i := range ts {
|
||
|
us[i] = f(ts[i])
|
||
|
}
|
||
|
return us
|
||
|
}
|