claptrap-go/utils/slices.go

12 lines
148 B
Go
Raw Permalink Normal View History

2024-07-08 18:09:43 +02:00
package utils
func Filter[T any](s []T, f func(T) bool) []T {
var r []T
for _, v := range s {
if f(v) {
r = append(r, v)
}
}
return r
}