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

Method NewDynamicArray

object_dynamic.go:138–149  ·  view source on GitHub ↗

* NewDynamicArray creates an array Object backed by the provided DynamicArray handler. It is similar to NewDynamicObject, the differences are: - the Object is an array (i.e. Array.isArray() will return true and it will have the length property). - the prototype will be initially set to Array.proto

(a DynamicArray)

Source from the content-addressed store, hash-verified

136- the Object cannot have any own string properties except for the 'length'.
137*/
138func (r *Runtime) NewDynamicArray(a DynamicArray) *Object {
139 v := &Object{runtime: r}
140 o := &dynamicArray{
141 a: a,
142 baseDynamicObject: baseDynamicObject{
143 val: v,
144 prototype: r.getArrayPrototype(),
145 },
146 }
147 v.self = o
148 return v
149}
150
151/*
152NewSharedDynamicArray is similar to Runtime.NewDynamicArray but the resulting Object can be shared across multiple

Callers 1

TestDynamicArrayFunction · 0.80

Calls 1

getArrayPrototypeMethod · 0.95

Tested by 1

TestDynamicArrayFunction · 0.64