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

Method stringKeys

object_dynamic.go:772–790  ·  view source on GitHub ↗
(all bool, accum []Value)

Source from the content-addressed store, hash-verified

770}
771
772func (a *dynamicArray) stringKeys(all bool, accum []Value) []Value {
773 al := a.a.Len()
774 l := len(accum) + al
775 if all {
776 l++
777 }
778 if l > cap(accum) {
779 oldAccum := accum
780 accum = make([]Value, len(oldAccum), l)
781 copy(accum, oldAccum)
782 }
783 for i := 0; i < al; i++ {
784 accum = append(accum, asciiString(strconv.Itoa(i)))
785 }
786 if all {
787 accum = append(accum, asciiString("length"))
788 }
789 return accum
790}
791
792func (a *dynamicArray) keys(all bool, accum []Value) []Value {
793 return a.stringKeys(all, accum)

Callers 1

keysMethod · 0.95

Calls 2

asciiStringTypeAlias · 0.85
LenMethod · 0.65

Tested by

no test coverage detected