Skip to content

Commit ffcdb41

Browse files
ialex32xsaghul
authored andcommitted
Add JS_IsMap function
1 parent 72a135f commit ffcdb41

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

quickjs.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10107,6 +10107,13 @@ JS_BOOL JS_IsRegExp(JSValue val)
1010710107
return JS_VALUE_GET_OBJ(val)->class_id == JS_CLASS_REGEXP;
1010810108
}
1010910109

10110+
JS_BOOL JS_IsMap(JSValue val)
10111+
{
10112+
if (JS_VALUE_GET_TAG(val) != JS_TAG_OBJECT)
10113+
return FALSE;
10114+
return JS_VALUE_GET_OBJ(val)->class_id == JS_CLASS_MAP;
10115+
}
10116+
1011010117
BOOL JS_IsError(JSContext *ctx, JSValue val)
1011110118
{
1011210119
JSObject *p;

quickjs.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -673,6 +673,7 @@ JS_EXTERN JS_BOOL JS_IsConstructor(JSContext* ctx, JSValue val);
673673
JS_EXTERN JS_BOOL JS_SetConstructorBit(JSContext *ctx, JSValue func_obj, JS_BOOL val);
674674

675675
JS_EXTERN JS_BOOL JS_IsRegExp(JSValue val);
676+
JS_EXTERN JS_BOOL JS_IsMap(JSValue val);
676677

677678
JS_EXTERN JSValue JS_NewArray(JSContext *ctx);
678679
JS_EXTERN int JS_IsArray(JSContext *ctx, JSValue val);

0 commit comments

Comments
 (0)