mirror of
https://github.com/thegeeklab/drone-admin.git
synced 2024-11-14 07:40:41 +00:00
12 lines
185 B
Go
12 lines
185 B
Go
package util
|
|
|
|
func Filter[T any](vs []T, f func(T) bool) []T {
|
|
filtered := make([]T, 0)
|
|
for _, v := range vs {
|
|
if f(v) {
|
|
filtered = append(filtered, v)
|
|
}
|
|
}
|
|
return filtered
|
|
}
|