From 10d41b50c2f3475cfbb6b7e6f8d76da5c07b16c8 Mon Sep 17 00:00:00 2001 From: Andy Street Date: Thu, 7 Jul 2016 04:36:00 -0700 Subject: [PATCH] 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 --- ReactCommon/cxxreact/Value.h | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/ReactCommon/cxxreact/Value.h b/ReactCommon/cxxreact/Value.h index c43a523a7..1aa965e9c 100644 --- a/ReactCommon/cxxreact/Value.h +++ b/ReactCommon/cxxreact/Value.h @@ -191,6 +191,11 @@ public: } } + template + ReturnType* getPrivate() const { + return static_cast(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); }