Skip to content

Commit 8a01f56

Browse files
authored
Add JS_IsSet function (#1075)
1 parent 47d6ce0 commit 8a01f56

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
@@ -10254,6 +10254,13 @@ bool JS_IsMap(JSValueConst val)
1025410254
return JS_VALUE_GET_OBJ(val)->class_id == JS_CLASS_MAP;
1025510255
}
1025610256

10257+
bool JS_IsSet(JSValueConst val)
10258+
{
10259+
if (JS_VALUE_GET_TAG(val) != JS_TAG_OBJECT)
10260+
return false;
10261+
return JS_VALUE_GET_OBJ(val)->class_id == JS_CLASS_SET;
10262+
}
10263+
1025710264
bool JS_IsError(JSContext *ctx, JSValueConst val)
1025810265
{
1025910266
JSObject *p;

quickjs.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -831,6 +831,7 @@ JS_EXTERN bool JS_SetConstructorBit(JSContext *ctx, JSValueConst func_obj, bool
831831

832832
JS_EXTERN bool JS_IsRegExp(JSValueConst val);
833833
JS_EXTERN bool JS_IsMap(JSValueConst val);
834+
JS_EXTERN bool JS_IsSet(JSValueConst val);
834835

835836
JS_EXTERN JSValue JS_NewArray(JSContext *ctx);
836837
// takes ownership of the values

0 commit comments

Comments
 (0)