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

Method export

object.go:957–975  ·  view source on GitHub ↗
(ctx *objectExportCtx)

Source from the content-addressed store, hash-verified

955}
956
957func (o *baseObject) export(ctx *objectExportCtx) interface{} {
958 if v, exists := ctx.get(o.val); exists {
959 return v
960 }
961 keys := o.stringKeys(false, nil)
962 m := make(map[string]interface{}, len(keys))
963 ctx.put(o.val, m)
964 for _, itemName := range keys {
965 itemNameStr := itemName.String()
966 v := o.val.self.getStr(itemName.string(), nil)
967 if v != nil {
968 m[itemNameStr] = exportValue(v, ctx)
969 } else {
970 m[itemNameStr] = nil
971 }
972 }
973
974 return m
975}
976
977func (o *baseObject) exportType() reflect.Type {
978 return reflectTypeMap

Callers

nothing calls this directly

Calls 7

stringKeysMethod · 0.95
exportValueFunction · 0.85
getMethod · 0.65
StringMethod · 0.65
getStrMethod · 0.65
stringMethod · 0.65
putMethod · 0.45

Tested by

no test coverage detected