2020-04-28 15:46:03 +03:00
|
|
|
// Package convert provides functions for type conversion.
|
|
|
|
package convert
|
|
|
|
|
|
|
|
// ToInteger converts it's argument to an Integer.
|
2023-04-03 13:34:24 +03:00
|
|
|
func ToInteger(v any) int {
|
2021-03-04 13:14:24 +03:00
|
|
|
return v.(int)
|
2020-04-28 15:46:03 +03:00
|
|
|
}
|
|
|
|
|
2021-03-05 10:43:08 +03:00
|
|
|
// ToBytes converts it's argument to a Buffer VM type.
|
2023-04-03 13:34:24 +03:00
|
|
|
func ToBytes(v any) []byte {
|
2021-03-02 14:43:58 +03:00
|
|
|
return v.([]byte)
|
2020-04-28 15:46:03 +03:00
|
|
|
}
|
|
|
|
|
2021-03-05 10:43:08 +03:00
|
|
|
// ToString converts it's argument to a ByteString VM type.
|
2023-04-03 13:34:24 +03:00
|
|
|
func ToString(v any) string {
|
2021-03-05 10:43:08 +03:00
|
|
|
return v.(string)
|
|
|
|
}
|
|
|
|
|
2020-04-28 15:46:03 +03:00
|
|
|
// ToBool converts it's argument to a Boolean.
|
2023-04-03 13:34:24 +03:00
|
|
|
func ToBool(v any) bool {
|
2021-03-02 14:43:58 +03:00
|
|
|
return v.(bool)
|
2020-04-28 15:46:03 +03:00
|
|
|
}
|