add Variable.IsUndefined()

This commit is contained in:
Daniel Kang 2019-01-15 17:17:08 -08:00
parent 344c96d280
commit d1f7baf054

View file

@ -153,3 +153,10 @@ func (v *Variable) String() string {
func (v *Variable) Object() objects.Object {
return *v.value
}
// IsUndefined returns true if the underlying value is undefined.
func (v *Variable) IsUndefined() bool {
_, isUndefined := (*v.value).(objects.Undefined)
return isUndefined
}