Fixed and refactored reflection.Len

This commit is contained in:
Hein
2025-11-11 17:07:44 +02:00
parent 1db1b924ef
commit f0e26b1c0d
2 changed files with 8 additions and 2 deletions

View File

@@ -1,13 +0,0 @@
package common
import "reflect"
func Len(v any) int {
val := reflect.ValueOf(v)
switch val.Kind() {
case reflect.Slice, reflect.Array, reflect.Map, reflect.String, reflect.Chan:
return val.Len()
default:
return 0
}
}