neo-go/pkg/interop/convert/convert.go
Anna Shaleva 6b21ad9922 *: replace interface{} with any keyword
Everywhere including examples, external interop APIs, bindings generators
code and in other valuable places. A couple of `interface{}` usages are
intentionally left in the CHANGELOG.md, documentation and tests.
2023-04-04 13:22:42 +03:00

22 lines
484 B
Go

// Package convert provides functions for type conversion.
package convert
// ToInteger converts it's argument to an Integer.
func ToInteger(v any) int {
return v.(int)
}
// ToBytes converts it's argument to a Buffer VM type.
func ToBytes(v any) []byte {
return v.([]byte)
}
// ToString converts it's argument to a ByteString VM type.
func ToString(v any) string {
return v.(string)
}
// ToBool converts it's argument to a Boolean.
func ToBool(v any) bool {
return v.(bool)
}