Implement Value.is* using getType

Reviewed By: mhorowitz

Differential Revision: D4197286

fbshipit-source-id: 893077a661bbf39b46ef9b10aa9ee552788882a6
This commit is contained in:
Pieter De Baets 2016-11-18 06:25:28 -08:00 committed by Facebook Github Bot
parent 892231545b
commit b1c91606ff
1 changed files with 6 additions and 6 deletions

View File

@ -249,7 +249,7 @@ public:
} }
bool isBoolean() const { bool isBoolean() const {
return JSValueIsBoolean(context(), m_value); return getType() == kJSTypeBoolean;
} }
bool asBoolean() const { bool asBoolean() const {
@ -257,15 +257,15 @@ public:
} }
bool isNumber() const { bool isNumber() const {
return JSValueIsNumber(context(), m_value); return getType() == kJSTypeNumber;
} }
bool isNull() const { bool isNull() const {
return JSValueIsNull(context(), m_value); return getType() == kJSTypeNull;
} }
bool isUndefined() const { bool isUndefined() const {
return JSValueIsUndefined(context(), m_value); return getType() == kJSTypeUndefined;
} }
double asNumber() const { double asNumber() const {
@ -285,13 +285,13 @@ public:
} }
bool isObject() const { bool isObject() const {
return JSValueIsObject(context(), m_value); return getType() == kJSTypeObject;
} }
Object asObject(); Object asObject();
bool isString() const { bool isString() const {
return JSValueIsString(context(), m_value); return getType() == kJSTypeString;
} }
String toString() noexcept { String toString() noexcept {