1
0
mirror of https://github.com/IBM/fp-go.git synced 2025-06-23 00:27:49 +02:00
Files
fp-go/option/type.go
Dr. Carsten Leue c07df5c771 initial checkin
Signed-off-by: Dr. Carsten Leue <carsten.leue@de.ibm.com>
2023-07-07 22:31:06 +02:00

15 lines
231 B
Go

package option
func toType[T any](a any) (T, bool) {
b, ok := a.(T)
return b, ok
}
func ToType[T any](src any) Option[T] {
return fromValidation(src, toType[T])
}
func ToAny[T any](src T) Option[any] {
return Of(any(src))
}