make application with base logic
This commit is contained in:
11
pkg/slices/map.go
Normal file
11
pkg/slices/map.go
Normal file
@ -0,0 +1,11 @@
|
||||
package slices
|
||||
|
||||
// Map slice from one type to another one.
|
||||
func Map[S any, E any](s []S, f func(S) E) []E {
|
||||
out := make([]E, len(s))
|
||||
for i := range s {
|
||||
out[i] = f(s[i])
|
||||
}
|
||||
|
||||
return out
|
||||
}
|
||||
Reference in New Issue
Block a user