10 lines
120 B
Go
10 lines
120 B
Go
|
package utils
|
||
|
|
||
|
func DerefOrDefault[T any](val *T, fallback T) T {
|
||
|
if val == nil {
|
||
|
return fallback
|
||
|
}
|
||
|
|
||
|
return *val
|
||
|
}
|