Files
slog/utils.go

11 lines
214 B
Go

package slog
// Map applies f to each element of s and returns the resulting slice.
func Map[T, R any](s []T, f func(T) R) []R {
out := make([]R, len(s))
for i, el := range s {
out[i] = f(el)
}
return out
}