From 88f6d86b6c782c73843a540b69a96f4c09daa507 Mon Sep 17 00:00:00 2001 From: Tor Andersson Date: Wed, 25 May 2022 16:33:53 +0200 Subject: [PATCH] Add js_isbooleanobject and js_isdateobject functions. --- json.c | 10 ++++++++++ mujs.h | 2 ++ 2 files changed, 12 insertions(+) diff --git a/json.c b/json.c index ea55151..335bcd1 100644 --- a/json.c +++ b/json.c @@ -15,6 +15,16 @@ int js_isstringobject(js_State *J, int idx) 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); diff --git a/mujs.h b/mujs.h index a62c7fe..920be29 100644 --- a/mujs.h +++ b/mujs.h @@ -198,6 +198,8 @@ int js_isuserdata(js_State *J, int idx, const char *tag); 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);