Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions mquickjs.c
Original file line number Diff line number Diff line change
Expand Up @@ -1150,6 +1150,16 @@ static JSObject *js_get_object_class(JSContext *ctx, JSValue val, int class_id)
}
}

BOOL JS_IsArray(JSContext *ctx, JSValue val)
{
if (!JS_IsPtr(val)) {
return FALSE;
} else {
JSObject *p = JS_VALUE_TO_PTR(val);
return (p->mtag == JS_MTAG_OBJECT && p->class_id == JS_CLASS_ARRAY);
}
}

BOOL JS_IsFunction(JSContext *ctx, JSValue val)
{
if (!JS_IsPtr(val)) {
Expand Down
1 change: 1 addition & 0 deletions mquickjs.h
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,7 @@ static inline JSValue JS_NewBool(int val)
JS_BOOL JS_IsNumber(JSContext *ctx, JSValue val);
JS_BOOL JS_IsString(JSContext *ctx, JSValue val);
JS_BOOL JS_IsError(JSContext *ctx, JSValue val);
JS_BOOL JS_IsArray(JSContext *ctx, JSValue val);
JS_BOOL JS_IsFunction(JSContext *ctx, JSValue val);

int JS_GetClassID(JSContext *ctx, JSValue val);
Expand Down