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

Method GlobalInstanceof

value.go:834–841  ·  view source on GitHub ↗

GlobalInstanceof checks if the value is an instance of the given global constructor

(name string)

Source from the content-addressed store, hash-verified

832
833// GlobalInstanceof checks if the value is an instance of the given global constructor
834func (v *Value) GlobalInstanceof(name string) bool {
835 ctor := v.ctx.Globals().Get(name)
836 defer ctor.Free()
837 if ctor.IsUndefined() {
838 return false
839 }
840 return C.JS_IsInstanceOf(v.ctx.ref, v.ref, ctor.ref) == 1
841}
842
843// getTypedArrayInfo is a helper function to extract TypedArray information using C API
844func (v *Value) getTypedArrayInfo() (buffer *Value, byteOffset, byteLength, bytesPerElement int) {

Callers 2

TestValueInstanceofFunction · 0.80

Calls 4

GetMethod · 0.80
GlobalsMethod · 0.80
IsUndefinedMethod · 0.80
FreeMethod · 0.45

Tested by 2

TestValueInstanceofFunction · 0.64