1
0
Fork 0
mirror of https://github.com/portainer/portainer.git synced 2025-07-23 15:29:42 +02:00

fix(edge/groups): filter selected environments [EE-5891] (#10050)

This commit is contained in:
Chaim Lev-Ari 2023-08-16 12:24:37 +03:00 committed by GitHub
parent a27cc6c0e5
commit a1e610a39a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 57 additions and 25 deletions

View file

@ -63,3 +63,12 @@ func RemoveIndex[T any](s []T, index int) []T {
s[index] = s[len(s)-1]
return s[:len(s)-1]
}
// Map applies the given function to each element of the slice and returns a new slice with the results
func Map[T, U any](s []T, f func(T) U) []U {
result := make([]U, len(s))
for i, v := range s {
result[i] = f(v)
}
return result
}