Add C API to query the type of a JS value (#2195)

New API function:
 * jerry_value_get_type

JerryScript-DCO-1.0-Signed-off-by: Peter Gal pgal.u-szeged@partner.samsung.com
This commit is contained in:
Péter Gál
2018-02-13 13:48:07 +01:00
committed by László Langó
parent 4652c3caaf
commit d7991ae54c
7 changed files with 266 additions and 41 deletions
+17
View File
@@ -286,6 +286,23 @@ bool jerry_value_is_promise (const jerry_value_t value);
bool jerry_value_is_string (const jerry_value_t value);
bool jerry_value_is_undefined (const jerry_value_t value);
/**
* JerryScript API value type information.
*/
typedef enum
{
JERRY_TYPE_NONE = 0u, /**< no type information */
JERRY_TYPE_UNDEFINED, /**< undefined type */
JERRY_TYPE_NULL, /**< null type */
JERRY_TYPE_BOOLEAN, /**< boolean type */
JERRY_TYPE_NUMBER, /**< number type */
JERRY_TYPE_STRING, /**< string type */
JERRY_TYPE_OBJECT, /**< object type */
JERRY_TYPE_FUNCTION, /**< function type */
} jerry_type_t;
jerry_type_t jerry_value_get_type (const jerry_value_t value);
/**
* Checker function of whether the specified compile feature is enabled.
*/