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)
| 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 |
| 1181 | func (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 |