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

Method getOwnPropStr

object_goarray_reflect.go:127–145  ·  view source on GitHub ↗
(name unistring.String)

Source from the content-addressed store, hash-verified

125}
126
127func (o *objectGoArrayReflect) getOwnPropStr(name unistring.String) Value {
128 if idx := strToGoIdx(name); idx >= 0 {
129 if idx < o.fieldsValue.Len() {
130 return &valueProperty{
131 value: o._getIdx(idx),
132 writable: true,
133 enumerable: true,
134 }
135 }
136 return nil
137 }
138 if name == "length" {
139 if o.fieldsValue.Kind() == reflect.Slice {
140 o.updateLen()
141 }
142 return &o.lengthProp
143 }
144 return o.objectGoReflect.getOwnPropStr(name)
145}
146
147func (o *objectGoArrayReflect) getOwnPropIdx(idx valueInt) Value {
148 if idx := toIntStrict(int64(idx)); idx >= 0 && idx < o.fieldsValue.Len() {

Callers

nothing calls this directly

Calls 5

_getIdxMethod · 0.95
updateLenMethod · 0.95
strToGoIdxFunction · 0.85
LenMethod · 0.65
getOwnPropStrMethod · 0.65

Tested by

no test coverage detected