aboutsummaryrefslogtreecommitdiff
path: root/pkg/list/list.go
blob: ff259f7f3dbf057e373eb36ecac89f97f6f0c6fd (plain)
1
2
3
4
5
6
7
8
9
package list

func Map[V any, T any](source []V, fun func(V) T) []T {
	result := make([]T, 0, len(source))
	for _, s := range source {
		result = append(result, fun(s))
	}
	return result
}