mirror of
https://github.com/nspcc-dev/neo-go.git
synced 2024-12-11 15:30:07 +00:00
7160675ac1
Allow to convert to both `Buffer` and `ByteString` and explicitly mention VM types. Rename `ToByteArray` to `ToBytes` to avoid ambiguity.
22 lines
516 B
Go
22 lines
516 B
Go
// Package convert provides functions for type conversion.
|
|
package convert
|
|
|
|
// ToInteger converts it's argument to an Integer.
|
|
func ToInteger(v interface{}) int {
|
|
return v.(int)
|
|
}
|
|
|
|
// ToBytes converts it's argument to a Buffer VM type.
|
|
func ToBytes(v interface{}) []byte {
|
|
return v.([]byte)
|
|
}
|
|
|
|
// ToString converts it's argument to a ByteString VM type.
|
|
func ToString(v interface{}) string {
|
|
return v.(string)
|
|
}
|
|
|
|
// ToBool converts it's argument to a Boolean.
|
|
func ToBool(v interface{}) bool {
|
|
return v.(bool)
|
|
}
|