Skip to content

Commit

Permalink
Add JS_IsMap function
Browse files Browse the repository at this point in the history
  • Loading branch information
ialex32x authored and saghul committed Jan 9, 2025
1 parent 72a135f commit ffcdb41
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
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

0 comments on commit ffcdb41

Please sign in to comment.