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

Method arrayproto_toString

builtin_array.go:228–251  ·  view source on GitHub ↗
(call FunctionCall)

Source from the content-addressed store, hash-verified

226}
227
228func (r *Runtime) arrayproto_toString(call FunctionCall) Value {
229 array := call.This.ToObject(r)
230 var toString func() Value
231 switch a := array.self.(type) {
232 case *objectGoSliceReflect:
233 toString = a.toString
234 case *objectGoArrayReflect:
235 toString = a.toString
236 }
237 if toString != nil {
238 return toString()
239 }
240 f := array.self.getStr("join", nil)
241 if fObj, ok := f.(*Object); ok {
242 if fcall, ok := fObj.self.assertCallable(); ok {
243 return fcall(FunctionCall{
244 This: array,
245 })
246 }
247 }
248 return r.objectproto_toString(FunctionCall{
249 This: array,
250 })
251}
252
253func (r *Runtime) writeItemLocaleString(item Value, buf *StringBuilder) {
254 if item != nil && item != _undefined && item != _null {

Callers

nothing calls this directly

Calls 5

objectproto_toStringMethod · 0.95
toStringFunction · 0.85
ToObjectMethod · 0.65
getStrMethod · 0.65
assertCallableMethod · 0.65

Tested by

no test coverage detected