mirror of
https://github.com/hay-kot/homebox.git
synced 2024-12-18 21:16:31 +00:00
10 lines
181 B
Go
10 lines
181 B
Go
|
package mappers
|
||
|
|
||
|
func MapEach[T any, U any](items []T, fn func(T) U) []U {
|
||
|
result := make([]U, len(items))
|
||
|
for i, item := range items {
|
||
|
result[i] = fn(item)
|
||
|
}
|
||
|
return result
|
||
|
}
|