neoneo-go/pkg/interop/convert/convert.go
Evgeniy Stratonikov 7160675ac1 compiler/interop: improve conversion to bytes interops
Allow to convert to both `Buffer` and `ByteString`
and explicitly mention VM types. Rename `ToByteArray` to `ToBytes`
to avoid ambiguity.
2021-03-10 13:38:44 +03:00

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)
}