Skip to content

Commit 36e3513

Browse files
authored
Add JS_IsDate function (#803)
1 parent 0fb7f4e commit 36e3513

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

quickjs.c

+7
Original file line numberDiff line numberDiff line change
@@ -51280,6 +51280,13 @@ JSValue JS_NewDate(JSContext *ctx, double epoch_ms)
5128051280
return obj;
5128151281
}
5128251282

51283+
JS_BOOL JS_IsDate(JSValue v)
51284+
{
51285+
if (JS_VALUE_GET_TAG(v) != JS_TAG_OBJECT)
51286+
return FALSE;
51287+
return JS_VALUE_GET_OBJ(v)->class_id == JS_CLASS_DATE;
51288+
}
51289+
5128351290
void JS_AddIntrinsicDate(JSContext *ctx)
5128451291
{
5128551292
JSValue obj;

quickjs.h

+1
Original file line numberDiff line numberDiff line change
@@ -676,6 +676,7 @@ JS_EXTERN JSValue JS_NewArray(JSContext *ctx);
676676
JS_EXTERN int JS_IsArray(JSContext *ctx, JSValue val);
677677

678678
JS_EXTERN JSValue JS_NewDate(JSContext *ctx, double epoch_ms);
679+
JS_EXTERN JS_BOOL JS_IsDate(JSValue v);
679680

680681
JS_EXTERN JSValue JS_GetProperty(JSContext *ctx, JSValue this_obj, JSAtom prop);
681682
JS_EXTERN JSValue JS_GetPropertyUint32(JSContext *ctx, JSValue this_obj,

0 commit comments

Comments
 (0)