minireader/internal/pkg/utils/deref.go

10 lines
120 B
Go
Raw Normal View History

2023-10-25 14:49:11 +00:00
package utils
func DerefOrDefault[T any](val *T, fallback T) T {
if val == nil {
return fallback
}
return *val
}