MCPcopy Create free account
hub / github.com/buke/quickjs-go / IsInstanceOfClassID

Method IsInstanceOfClassID

value.go:1181–1189  ·  view source on GitHub ↗

IsInstanceOfClassID checks if the value is an instance of a specific class ID This provides type-safe class instance checking with double validation

(expectedClassID uint32)

Source from the content-addressed store, hash-verified

1179// IsInstanceOfClassID checks if the value is an instance of a specific class ID
1180// This provides type-safe class instance checking with double validation
1181func (v *Value) IsInstanceOfClassID(expectedClassID uint32) bool {
1182 if v == nil || !v.IsObject() {
1183 return false
1184 }
1185
1186 // Only check class ID match - no opaque data requirement
1187 objClassID := uint32(C.JS_GetClassID(v.ref))
1188 return objClassID == expectedClassID
1189}
1190
1191// GetClassID returns the class ID of the value if it's a class instance
1192// Returns JS_INVALID_CLASS_ID (0) if not a class instance

Callers 2

Calls 1

IsObjectMethod · 0.95

Tested by 2