MCPcopy Create free account
hub / github.com/dop251/goja / getOwnPropertyDescriptorStr

Method getOwnPropertyDescriptorStr

builtin_proxy.go:39–51  ·  view source on GitHub ↗
(target *Object, prop unistring.String)

Source from the content-addressed store, hash-verified

37}
38
39func (h *nativeProxyHandler) getOwnPropertyDescriptorStr(target *Object, prop unistring.String) (Value, bool) {
40 if trap := h.handler.GetOwnPropertyDescriptorIdx; trap != nil {
41 if idx, ok := strToInt(prop); ok {
42 desc := trap(target, idx)
43 return desc.toValue(target.runtime), true
44 }
45 }
46 if trap := h.handler.GetOwnPropertyDescriptor; trap != nil {
47 desc := trap(target, prop.String())
48 return desc.toValue(target.runtime), true
49 }
50 return nil, false
51}
52
53func (h *nativeProxyHandler) getOwnPropertyDescriptorIdx(target *Object, prop valueInt) (Value, bool) {
54 if trap := h.handler.GetOwnPropertyDescriptorIdx; trap != nil {

Callers

nothing calls this directly

Calls 3

strToIntFunction · 0.85
toValueMethod · 0.65
StringMethod · 0.65

Tested by

no test coverage detected