Precalculate index stats
This commit is contained in:
@@ -12,3 +12,13 @@ func UniqueBy[T any, K comparable](items []T, keySelector func(T) K) []T {
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
||||
func Where[T any](items []T, predicate func(T) bool) []T {
|
||||
result := make([]T, 0)
|
||||
for _, item := range items {
|
||||
if predicate(item) {
|
||||
result = append(result, item)
|
||||
}
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user