mirror of
https://github.com/foomo/gocontemplate.git
synced 2025-10-16 12:35:36 +00:00
14 lines
196 B
Go
14 lines
196 B
Go
package gocontemplate
|
|
|
|
// TC type conversion helper
|
|
func TC[T any](input any) T {
|
|
var output T
|
|
if input == nil {
|
|
return output
|
|
}
|
|
if t, ok := input.(T); ok {
|
|
output = t
|
|
}
|
|
return output
|
|
}
|