xgo/script/conversion.go

31 lines
518 B
Go
Raw Normal View History

2019-01-09 23:39:40 +03:00
package script
import (
"github.com/d5/tengo/objects"
)
func objectToInterface(o objects.Object) interface{} {
switch val := o.(type) {
case *objects.Array:
return val.Value
case *objects.Map:
return val.Value
case *objects.Int:
return val.Value
case *objects.Float:
return val.Value
case *objects.Bool:
return val.Value
case *objects.Char:
return val.Value
case *objects.String:
return val.Value
2019-01-18 12:43:46 +03:00
case *objects.Bytes:
return val.Value
2019-01-11 14:15:31 +03:00
case *objects.Undefined:
return nil
2019-01-09 23:39:40 +03:00
}
2019-01-11 14:15:31 +03:00
return o
2019-01-09 23:39:40 +03:00
}