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