func (value Value) IsBoolean() bool {
	return value.kind == valueBoolean
}
IsBoolean will return true if value is a boolean (primitive).
package otto
import (
	"fmt"
	"math"
	"reflect"
	"strconv"
	"unicode/utf16"
)
type _valueKind int
const (
	valueUndefined _valueKind = iota
	valueNull
	valueNumber
	valueString
	valueBoolean
	valueObject
	valueEmpty
	valueResult
	valueReference
)
type Value struct {
	kind  _valueKind
	value interface{}
}
func (value Value) safe() bool {
	return value.kind < valueEmpty
}
var (
	emptyValue = Value{kind: valueEmpty}
	nullValue  = Value{kind: valueNull}
	falseValue = Value{kind: valueBoolean, value: false}
	trueValue  = Value{kind: valueBoolean, value: true}
)
func ToValue(value interface{}) (Value, error) {
	result := Value{}
	err := catchPanic(func() {
		result = toValue(value)
	})
	return result, err
}
func (value Value) isEmpty() bool {
	return value.kind == valueEmpty
}
func UndefinedValue() Value {
	return Value{}
}
func (value Value) IsDefined() bool {
	return value.kind != valueUndefined
}
func (value Value) IsUndefined() bool {
	return value.kind == valueUndefined
}
func NullValue() Value {
	return Value{kind: valueNull}
}
func (value Value) IsNull() bool {
	return value.kind == valueNull
}
func (value Value) isCallable() bool {
	switch value := value.value.(type) {
	case *_object:
		return value.isCall()
	}
	return false
}
func (value Value) Call(this Value, argumentList ...interface{}) (Value, error) {
	result := Value{}
	err := catchPanic(func() {
		result = value.call(nil, this, argumentList...)
	})
	if !value.safe() {
		value = Value{}
	}
	return result, err
}
func (value Value) call(rt *_runtime, this Value, argumentList ...interface{}) Value {
	switch function := value.value.(type) {
	case *_object:
		return function.call(this, function.runtime.toValueArray(argumentList...), false, nativeFrame)
	}
	if rt == nil {
		panic("FIXME TypeError")
	}
	panic(rt.panicTypeError())
}
func (value Value) constructSafe(rt *_runtime, this Value, argumentList ...interface{}) (Value, error) {
	result := Value{}
	err := catchPanic(func() {
		result = value.construct(rt, this, argumentList...)
	})
	return result, err
}
func (value Value) construct(rt *_runtime, this Value, argumentList ...interface{}) Value {
	switch fn := value.value.(type) {
	case *_object:
		return fn.construct(fn.runtime.toValueArray(argumentList...))
	}
	if rt == nil {
		panic("FIXME TypeError")
	}
	panic(rt.panicTypeError())
}
func (value Value) IsPrimitive() bool {
	return !value.IsObject()
}