v1.0.8
This commit is contained in:
兔子
2023-04-14 17:48:27 +08:00
parent c699bc7d0c
commit a40ce9169d
3 changed files with 70 additions and 44 deletions

9
utils/basics.go Normal file
View File

@@ -0,0 +1,9 @@
package utils
// ForMap - 遍历数组,返回新数组
func ForMap[T any](slice []T, fun func(item T) (result T)) (newSlice []T) {
for key, val := range slice {
slice[key] = fun(val)
}
return slice
}