diff --git a/utils.go b/utils.go index 9b6b7e7..7dbeecf 100644 --- a/utils.go +++ b/utils.go @@ -135,23 +135,25 @@ func anyInteger(v any) (i int64, ok bool) { } func fromGenericAny(v any) (exprAny any, ok bool) { - if exprAny, ok = v.(bool); ok { - return - } - if exprAny, ok = v.(string); ok { - return - } - if exprAny, ok = anyInteger(v); ok { - return - } - if exprAny, ok = anyFloat(v); ok { - return - } - if exprAny, ok = v.(*DictType); ok { - return - } - if exprAny, ok = v.(*ListType); ok { - return + if v != nil { + if exprAny, ok = v.(bool); ok { + return + } + if exprAny, ok = v.(string); ok { + return + } + if exprAny, ok = anyInteger(v); ok { + return + } + if exprAny, ok = anyFloat(v); ok { + return + } + if exprAny, ok = v.(*DictType); ok { + return + } + if exprAny, ok = v.(*ListType); ok { + return + } } return } @@ -176,10 +178,10 @@ func CopyMap[K comparable, V any](dest, source map[K]V) map[K]V { return dest } -func CloneMap[K comparable, V any](source map[K]V) map[K]V { - dest := make(map[K]V, len(source)) - return CopyMap(dest, source) -} +// func CloneMap[K comparable, V any](source map[K]V) map[K]V { +// dest := make(map[K]V, len(source)) +// return CopyMap(dest, source) +// } func CopyFilteredMap[K comparable, V any](dest, source map[K]V, filter func(key K) (accept bool)) map[K]V { // fmt.Printf("--- Clone with filter %p\n", filter)