Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add JS_IsMap function #808

Merged
merged 1 commit into from
Jan 9, 2025
Merged
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
7 changes: 7 additions & 0 deletions quickjs.c
Original file line number Diff line number Diff line change
Expand Up @@ -10107,6 +10107,13 @@ JS_BOOL JS_IsRegExp(JSValue val)
return JS_VALUE_GET_OBJ(val)->class_id == JS_CLASS_REGEXP;
}

JS_BOOL JS_IsMap(JSValue val)
{
if (JS_VALUE_GET_TAG(val) != JS_TAG_OBJECT)
return FALSE;
return JS_VALUE_GET_OBJ(val)->class_id == JS_CLASS_MAP;
}

BOOL JS_IsError(JSContext *ctx, JSValue val)
{
JSObject *p;
Expand Down
1 change: 1 addition & 0 deletions quickjs.h
Original file line number Diff line number Diff line change
Expand Up @@ -673,6 +673,7 @@ JS_EXTERN JS_BOOL JS_IsConstructor(JSContext* ctx, JSValue val);
JS_EXTERN JS_BOOL JS_SetConstructorBit(JSContext *ctx, JSValue func_obj, JS_BOOL val);

JS_EXTERN JS_BOOL JS_IsRegExp(JSValue val);
JS_EXTERN JS_BOOL JS_IsMap(JSValue val);

JS_EXTERN JSValue JS_NewArray(JSContext *ctx);
JS_EXTERN int JS_IsArray(JSContext *ctx, JSValue val);
Expand Down
Loading