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

Method _deleteIdxProp

array.go:464–479  ·  view source on GitHub ↗
(idx uint32, throw bool)

Source from the content-addressed store, hash-verified

462}
463
464func (a *arrayObject) _deleteIdxProp(idx uint32, throw bool) bool {
465 if idx < uint32(len(a.values)) {
466 if v := a.values[idx]; v != nil {
467 if p, ok := v.(*valueProperty); ok {
468 if !p.configurable {
469 a.val.runtime.typeErrorResult(throw, "Cannot delete property '%d' of %s", idx, a.val.toString())
470 return false
471 }
472 a.propValueCount--
473 }
474 a.values[idx] = nil
475 a.objCount--
476 }
477 }
478 return true
479}
480
481func (a *arrayObject) deleteStr(name unistring.String, throw bool) bool {
482 if idx := strToArrayIdx(name); idx != math.MaxUint32 {

Callers 2

deleteStrMethod · 0.95
deleteIdxMethod · 0.95

Calls 2

typeErrorResultMethod · 0.80
toStringMethod · 0.65

Tested by

no test coverage detected