feat: docs api design
This commit is contained in:
19
pkg/utils/collections.go
Normal file
19
pkg/utils/collections.go
Normal file
@@ -0,0 +1,19 @@
|
||||
package utils
|
||||
|
||||
func Any[T any](items []T, predicate func(T) bool) bool {
|
||||
for _, item := range items {
|
||||
if predicate(item) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func All[T any](items []T, predicate func(T) bool) bool {
|
||||
for _, item := range items {
|
||||
if !predicate(item) {
|
||||
return false
|
||||
}
|
||||
}
|
||||
return true
|
||||
}
|
||||
Reference in New Issue
Block a user