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

Method export

array.go:495–516  ·  view source on GitHub ↗
(ctx *objectExportCtx)

Source from the content-addressed store, hash-verified

493}
494
495func (a *arrayObject) export(ctx *objectExportCtx) interface{} {
496 if v, exists := ctx.get(a.val); exists {
497 return v
498 }
499 arr := make([]interface{}, a.length)
500 ctx.put(a.val, arr)
501 if a.propValueCount == 0 && a.length == uint32(len(a.values)) && uint32(a.objCount) == a.length {
502 for i, v := range a.values {
503 if v != nil {
504 arr[i] = exportValue(v, ctx)
505 }
506 }
507 } else {
508 for i := uint32(0); i < a.length; i++ {
509 v := a.getIdx(valueInt(i), nil)
510 if v != nil {
511 arr[i] = exportValue(v, ctx)
512 }
513 }
514 }
515 return arr
516}
517
518func (a *arrayObject) exportType() reflect.Type {
519 return reflectTypeArray

Callers

nothing calls this directly

Calls 5

getIdxMethod · 0.95
exportValueFunction · 0.85
valueIntTypeAlias · 0.85
getMethod · 0.65
putMethod · 0.45

Tested by

no test coverage detected