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.
|
2021-03-04 10:14:24 +00:00
|
|
|
func ToInteger(v interface{}) int {
|
|
|
|
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.
|
|
|
|
func ToBytes(v interface{}) []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.
|
|
|
|
func ToString(v interface{}) string {
|
|
|
|
return v.(string)
|
|
|
|
}
|
|
|
|
|
2020-04-28 12:46:03 +00:00
|
|
|
// ToBool converts it's argument to a Boolean.
|
|
|
|
func ToBool(v interface{}) bool {
|
2021-03-02 11:43:58 +00:00
|
|
|
return v.(bool)
|
2020-04-28 12:46:03 +00:00
|
|
|
}
|