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:
parent
a27cc6c0e5
commit
a1e610a39a
7 changed files with 57 additions and 25 deletions
|
@ -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
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue