ref: 88f6d86b6c782c73843a540b69a96f4c09daa507
parent: f5b3c703e18725e380b83427004632e744f85a6f
author: Tor Andersson <tor.andersson@artifex.com>
date: Wed May 25 12:33:53 EDT 2022
Add js_isbooleanobject and js_isdateobject functions.
--- a/json.c
+++ b/json.c
@@ -15,6 +15,16 @@
return js_isobject(J, idx) && js_toobject(J, idx)->type == JS_CSTRING;
}
+int js_isbooleanobject(js_State *J, int idx)
+{
+ return js_isobject(J, idx) && js_toobject(J, idx)->type == JS_CBOOLEAN;
+}
+
+int js_isdateobject(js_State *J, int idx)
+{
+ return js_isobject(J, idx) && js_toobject(J, idx)->type == JS_CDATE;
+}
+
static void jsonnext(js_State *J)
{
J->lookahead = jsY_lexjson(J);
--- a/mujs.h
+++ b/mujs.h
@@ -198,6 +198,8 @@
int js_iserror(js_State *J, int idx);
int js_isnumberobject(js_State *J, int idx);
int js_isstringobject(js_State *J, int idx);
+int js_isbooleanobject(js_State *J, int idx);
+int js_isdateobject(js_State *J, int idx);
int js_toboolean(js_State *J, int idx);
double js_tonumber(js_State *J, int idx);