init
This commit is contained in:
commit
c5cc245e25
29 changed files with 926 additions and 0 deletions
11
util/map.go
Normal file
11
util/map.go
Normal file
|
@ -0,0 +1,11 @@
|
|||
package util
|
||||
|
||||
func Map[In, Out any](inSlice []In, predicate func(In) Out) []Out {
|
||||
outSlice := make([]Out, len(inSlice))
|
||||
|
||||
for i := range inSlice {
|
||||
outSlice[i] = predicate(inSlice[i])
|
||||
}
|
||||
|
||||
return outSlice
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue