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

Method writeItemLocaleString

builtin_array.go:253–266  ·  view source on GitHub ↗
(item Value, buf *StringBuilder)

Source from the content-addressed store, hash-verified

251}
252
253func (r *Runtime) writeItemLocaleString(item Value, buf *StringBuilder) {
254 if item != nil && item != _undefined && item != _null {
255 if f, ok := r.getVStr(item, "toLocaleString").(*Object); ok {
256 if c, ok := f.self.assertCallable(); ok {
257 strVal := c(FunctionCall{
258 This: item,
259 })
260 buf.WriteString(strVal.toString())
261 return
262 }
263 }
264 r.typeErrorResult(true, "Property 'toLocaleString' of object %s is not a function", item)
265 }
266}
267
268func (r *Runtime) arrayproto_toLocaleString(call FunctionCall) Value {
269 array := call.This.ToObject(r)

Callers 2

Calls 5

getVStrMethod · 0.95
typeErrorResultMethod · 0.95
WriteStringMethod · 0.80
assertCallableMethod · 0.65
toStringMethod · 0.65

Tested by

no test coverage detected