Compare commits

...

1 Commits

Author SHA1 Message Date
007c44df85 v0.0.94 2023-03-21 16:00:15 +01:00

View File

@@ -60,3 +60,12 @@ func CoalesceStringer(s fmt.Stringer, def string) string {
return s.String()
}
}
func SafeCast[T any](v any, def T) T {
switch r := v.(type) {
case T:
return r
default:
return def
}
}