@@ -560,15 +560,6 @@ function formatValue(ctx, value, recurseTimes, typedArray) {
560560 return formatRaw ( ctx , value , recurseTimes , typedArray ) ;
561561}
562562
563- function setIteratorBraces ( type , tag ) {
564- if ( tag !== `${ type } Iterator` ) {
565- if ( tag !== '' )
566- tag += '] [' ;
567- tag += `${ type } Iterator` ;
568- }
569- return [ `[${ tag } ] {` , '}' ] ;
570- }
571-
572563function formatRaw ( ctx , value , recurseTimes , typedArray ) {
573564 let keys ;
574565
@@ -630,11 +621,11 @@ function formatRaw(ctx, value, recurseTimes, typedArray) {
630621 extrasType = kArrayExtrasType ;
631622 } else if ( isMapIterator ( value ) ) {
632623 keys = getKeys ( value , ctx . showHidden ) ;
633- braces = setIteratorBraces ( 'Map' , tag ) ;
624+ braces = getIteratorBraces ( 'Map' , tag ) ;
634625 formatter = formatIterator ;
635626 } else if ( isSetIterator ( value ) ) {
636627 keys = getKeys ( value , ctx . showHidden ) ;
637- braces = setIteratorBraces ( 'Set' , tag ) ;
628+ braces = getIteratorBraces ( 'Set' , tag ) ;
638629 formatter = formatIterator ;
639630 } else {
640631 noIterator = true ;
@@ -754,10 +745,10 @@ function formatRaw(ctx, value, recurseTimes, typedArray) {
754745 }
755746 }
756747 if ( isMapIterator ( value ) ) {
757- braces = setIteratorBraces ( 'Map' , tag ) ;
748+ braces = getIteratorBraces ( 'Map' , tag ) ;
758749 formatter = formatIterator ;
759750 } else if ( isSetIterator ( value ) ) {
760- braces = setIteratorBraces ( 'Set' , tag ) ;
751+ braces = getIteratorBraces ( 'Set' , tag ) ;
761752 formatter = formatIterator ;
762753 // Handle other regular objects again.
763754 } else if ( keys . length === 0 ) {
@@ -818,6 +809,15 @@ function formatRaw(ctx, value, recurseTimes, typedArray) {
818809 return res ;
819810}
820811
812+ function getIteratorBraces ( type , tag ) {
813+ if ( tag !== `${ type } Iterator` ) {
814+ if ( tag !== '' )
815+ tag += '] [' ;
816+ tag += `${ type } Iterator` ;
817+ }
818+ return [ `[${ tag } ] {` , '}' ] ;
819+ }
820+
821821function formatError ( err , constructor , tag , ctx ) {
822822 // TODO(BridgeAR): Always show the error code if present.
823823 let stack = err . stack || ErrorPrototype . toString ( err ) ;
0 commit comments