@@ -557,7 +557,6 @@ function formatRaw(ctx, value, recurseTimes, typedArray) {
557
557
let braces ;
558
558
let noIterator = true ;
559
559
let i = 0 ;
560
- let skip = false ;
561
560
const filter = ctx . showHidden ? ALL_PROPERTIES : ONLY_ENUMERABLE ;
562
561
563
562
let extrasType = kObjectType ;
@@ -701,7 +700,6 @@ function formatRaw(ctx, value, recurseTimes, typedArray) {
701
700
} else if ( isModuleNamespaceObject ( value ) ) {
702
701
braces [ 0 ] = `[${ tag } ] {` ;
703
702
formatter = formatNamespaceObject ;
704
- skip = true ;
705
703
} else if ( isBoxedPrimitive ( value ) ) {
706
704
let type ;
707
705
if ( isNumberObject ( value ) ) {
@@ -761,11 +759,9 @@ function formatRaw(ctx, value, recurseTimes, typedArray) {
761
759
const indentationLvl = ctx . indentationLvl ;
762
760
try {
763
761
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 ) ) ;
769
765
}
770
766
} catch ( err ) {
771
767
return handleMaxCallStackSize ( ctx , err , constructor , tag , indentationLvl ) ;
@@ -875,9 +871,8 @@ function formatError(value) {
875
871
}
876
872
877
873
function 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 ++ ) {
881
876
try {
882
877
output [ i ] = formatProperty ( ctx , value , recurseTimes , keys [ i ] ,
883
878
kObjectType ) ;
@@ -897,6 +892,8 @@ function formatNamespaceObject(ctx, value, recurseTimes, keys) {
897
892
ctx . stylize ( '<uninitialized>' , 'special' ) ;
898
893
}
899
894
}
895
+ // Reset the keys to an empty array. This prevents duplicated inspection.
896
+ keys . length = 0 ;
900
897
return output ;
901
898
}
902
899
0 commit comments