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

Method createListFromArrayLike

builtin_function.go:78–89  ·  view source on GitHub ↗
(a Value)

Source from the content-addressed store, hash-verified

76}
77
78func (r *Runtime) createListFromArrayLike(a Value) []Value {
79 o := r.toObject(a)
80 if arr := r.checkStdArrayObj(o); arr != nil {
81 return arr.values
82 }
83 l := toLength(o.self.getStr("length", nil))
84 res := make([]Value, 0, l)
85 for k := int64(0); k < l; k++ {
86 res = append(res, nilSafe(o.self.getIdx(valueInt(k), nil)))
87 }
88 return res
89}
90
91func (r *Runtime) functionproto_apply(call FunctionCall) Value {
92 var args []Value

Callers 3

builtin_reflect_applyMethod · 0.95
functionproto_applyMethod · 0.95

Calls 7

toObjectMethod · 0.95
checkStdArrayObjMethod · 0.95
toLengthFunction · 0.85
nilSafeFunction · 0.85
valueIntTypeAlias · 0.85
getStrMethod · 0.65
getIdxMethod · 0.65

Tested by

no test coverage detected