Skip to content

Commit d6f5369

Browse files
harumazzzsaghul
authored andcommitted
Add JS_IsWeakMap
1 parent dfdf15e commit d6f5369

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
@@ -10289,6 +10289,13 @@ bool JS_IsWeakSet(JSValueConst val)
1028910289
return JS_VALUE_GET_OBJ(val)->class_id == JS_CLASS_WEAKSET;
1029010290
}
1029110291

10292+
bool JS_IsWeakMap(JSValueConst val)
10293+
{
10294+
if (JS_VALUE_GET_TAG(val) != JS_TAG_OBJECT)
10295+
return false;
10296+
return JS_VALUE_GET_OBJ(val)->class_id == JS_CLASS_WEAKMAP;
10297+
}
10298+
1029210299
bool JS_IsError(JSContext *ctx, JSValueConst val)
1029310300
{
1029410301
JSObject *p;

quickjs.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -834,6 +834,7 @@ JS_EXTERN bool JS_IsMap(JSValueConst val);
834834
JS_EXTERN bool JS_IsSet(JSValueConst val);
835835
JS_EXTERN bool JS_IsWeakRef(JSValueConst val);
836836
JS_EXTERN bool JS_IsWeakSet(JSValueConst val);
837+
JS_EXTERN bool JS_IsWeakMap(JSValueConst val);
837838

838839
JS_EXTERN JSValue JS_NewArray(JSContext *ctx);
839840
// takes ownership of the values

0 commit comments

Comments
 (0)