Add getType/getPrivate to Value

Summary:
Adds:
 - getType so you can switch on type
 - getPrivate

Reviewed By: lexs

Differential Revision: D3515510

fbshipit-source-id: d574b04f563ac650bacec3751b50be6345e8439a
This commit is contained in:
Andy Street 2016-07-07 04:36:00 -07:00 коммит произвёл Facebook Github Bot 8
Родитель 201433f05b
Коммит 10d41b50c2
1 изменённых файлов: 9 добавлений и 0 удалений

Просмотреть файл

@ -191,6 +191,11 @@ public:
}
}
template<typename ReturnType>
ReturnType* getPrivate() const {
return static_cast<ReturnType*>(JSObjectGetPrivate(m_obj));
}
JSContextRef context() const {
return m_context;
}
@ -223,6 +228,10 @@ public:
return m_value;
}
JSType getType() const {
return JSValueGetType(m_context, m_value);
}
bool isBoolean() const {
return JSValueIsBoolean(context(), m_value);
}