@@ -557,7 +557,6 @@ function formatRaw(ctx, value, recurseTimes, typedArray) {
557557 let braces ;
558558 let noIterator = true ;
559559 let i = 0 ;
560- let skip = false ;
561560 const filter = ctx . showHidden ? ALL_PROPERTIES : ONLY_ENUMERABLE ;
562561
563562 let extrasType = kObjectType ;
@@ -701,7 +700,6 @@ function formatRaw(ctx, value, recurseTimes, typedArray) {
701700 } else if ( isModuleNamespaceObject ( value ) ) {
702701 braces [ 0 ] = `[${ tag } ] {` ;
703702 formatter = formatNamespaceObject ;
704- skip = true ;
705703 } else if ( isBoxedPrimitive ( value ) ) {
706704 let type ;
707705 if ( isNumberObject ( value ) ) {
@@ -761,11 +759,9 @@ function formatRaw(ctx, value, recurseTimes, typedArray) {
761759 const indentationLvl = ctx . indentationLvl ;
762760 try {
763761 output = formatter ( ctx , value , recurseTimes , keys ) ;
764- if ( skip === false ) {
765- for ( i = 0 ; i < keys . length ; i ++ ) {
766- output . push (
767- formatProperty ( ctx , value , recurseTimes , keys [ i ] , extrasType ) ) ;
768- }
762+ for ( i = 0 ; i < keys . length ; i ++ ) {
763+ output . push (
764+ formatProperty ( ctx , value , recurseTimes , keys [ i ] , extrasType ) ) ;
769765 }
770766 } catch ( err ) {
771767 return handleMaxCallStackSize ( ctx , err , constructor , tag , indentationLvl ) ;
@@ -875,9 +871,8 @@ function formatError(value) {
875871}
876872
877873function formatNamespaceObject ( ctx , value , recurseTimes , keys ) {
878- const len = keys . length ;
879- const output = new Array ( len ) ;
880- for ( var i = 0 ; i < len ; i ++ ) {
874+ const output = new Array ( keys . length ) ;
875+ for ( var i = 0 ; i < keys . length ; i ++ ) {
881876 try {
882877 output [ i ] = formatProperty ( ctx , value , recurseTimes , keys [ i ] ,
883878 kObjectType ) ;
@@ -897,6 +892,8 @@ function formatNamespaceObject(ctx, value, recurseTimes, keys) {
897892 ctx . stylize ( '<uninitialized>' , 'special' ) ;
898893 }
899894 }
895+ // Reset the keys to an empty array. This prevents duplicated inspection.
896+ keys . length = 0 ;
900897 return output ;
901898}
902899
0 commit comments