Explorar o código

jsre: hide fields with prefix _ when pretty-printing

This makes web3 internals like _requestManager invisible.
Felix Lange %!s(int64=9) %!d(string=hai) anos
pai
achega
05e257c22c
Modificáronse 1 ficheiros con 1 adicións e 1 borrados
  1. 1 1
      jsre/pretty.go

+ 1 - 1
jsre/pretty.go

@@ -177,7 +177,7 @@ func (ctx ppctx) fields(obj *otto.Object) []string {
 		seen          = make(map[string]bool)
 	)
 	add := func(k string) {
-		if seen[k] || boringKeys[k] {
+		if seen[k] || boringKeys[k] || strings.HasPrefix(k, "_") {
 			return
 		}
 		seen[k] = true