From d1f7baf054185ca931d41d9320f488d0af05fa9e Mon Sep 17 00:00:00 2001 From: Daniel Kang Date: Tue, 15 Jan 2019 17:17:08 -0800 Subject: [PATCH] add Variable.IsUndefined() --- script/variable.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/script/variable.go b/script/variable.go index 51c7a84..81cc40f 100644 --- a/script/variable.go +++ b/script/variable.go @@ -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 +}