Module split

This commit is contained in:
Ian Gulliver
2023-04-20 18:01:36 +00:00
parent e0c92c24fb
commit f50e6e228c
30 changed files with 4293 additions and 0 deletions

27
slice.go Normal file
View File

@@ -0,0 +1,27 @@
package path
import "reflect"
func isSlice(v any) bool {
return reflect.TypeOf(v).Kind() == reflect.Slice
}
func anyTrue(v any, cb func(any, int) bool) bool {
val := reflect.ValueOf(v)
for i := 0; i < val.Len(); i++ {
sub := val.Index(i)
if sub.Kind() == reflect.Pointer && sub.IsNil() {
continue
}
sub = reflect.Indirect(sub)
if cb(sub.Interface(), i) {
return true
}
}
return false
}