Merge status and query player data (#7)

This commit is contained in:
Jacob
2023-08-13 10:40:10 -05:00
committed by GitHub
parent 2782ac52e6
commit 06da2df1b0
2 changed files with 41 additions and 2 deletions

View File

@@ -255,3 +255,25 @@ func SHA256(input string) string {
func PointerOf[T any](v T) *T {
return &v
}
// Contains returns true if the array contains the value.
func Contains[T comparable](arr []T, v T) bool {
for _, value := range arr {
if value == v {
return true
}
}
return false
}
// Map applies the provided map function to all of the values in the array and returns the result.
func Map[I, O any](arr []I, f func(I) O) []O {
result := make([]O, len(arr))
for i, v := range arr {
result[i] = f(v)
}
return result
}