mirror of
https://github.com/rjNemo/underscore
synced 2026-06-06 02:26:42 +00:00
9 lines
191 B
Go
9 lines
191 B
Go
package underscore
|
|
|
|
func Map[T, P any](values []T, predicate func(T) P) []P {
|
|
res := make([]P, 0, len(values))
|
|
for _, v := range values {
|
|
res = append(res, predicate(v))
|
|
}
|
|
return res
|
|
}
|