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

Method SetLen

object_dynamic_test.go:83–99  ·  view source on GitHub ↗
(i int)

Source from the content-addressed store, hash-verified

81}
82
83func (t *testDynArray) SetLen(i int) bool {
84 if i > len(t.a) {
85 t.expand(i)
86 return true
87 }
88 if i < 0 {
89 return false
90 }
91 if i < len(t.a) {
92 tail := t.a[i:len(t.a)]
93 for j := range tail {
94 tail[j] = nil
95 }
96 t.a = t.a[:i]
97 }
98 return true
99}
100
101func TestDynamicObject(t *testing.T) {
102 vm := New()

Callers

nothing calls this directly

Calls 1

expandMethod · 0.95

Tested by

no test coverage detected