dal/pkg/utils/common.go

10 lines
143 B
Go
Raw Normal View History

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
}