@@ -560,15 +560,6 @@ function formatValue(ctx, value, recurseTimes, typedArray) {
560560return 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 ) {
573564let keys ;
574565
@@ -630,11 +621,11 @@ function formatRaw(ctx, value, recurseTimes, typedArray) {
630621extrasType = kArrayExtrasType ;
631622} else if ( isMapIterator ( value ) ) {
632623keys = getKeys ( value , ctx . showHidden ) ;
633- braces = setIteratorBraces ( 'Map' , tag ) ;
624+ braces = getIteratorBraces ( 'Map' , tag ) ;
634625formatter = formatIterator ;
635626} else if ( isSetIterator ( value ) ) {
636627keys = getKeys ( value , ctx . showHidden ) ;
637- braces = setIteratorBraces ( 'Set' , tag ) ;
628+ braces = getIteratorBraces ( 'Set' , tag ) ;
638629formatter = formatIterator ;
639630} else {
640631noIterator = true ;
@@ -754,10 +745,10 @@ function formatRaw(ctx, value, recurseTimes, typedArray) {
754745}
755746}
756747if ( isMapIterator ( value ) ) {
757- braces = setIteratorBraces ( 'Map' , tag ) ;
748+ braces = getIteratorBraces ( 'Map' , tag ) ;
758749formatter = formatIterator ;
759750} else if ( isSetIterator ( value ) ) {
760- braces = setIteratorBraces ( 'Set' , tag ) ;
751+ braces = getIteratorBraces ( 'Set' , tag ) ;
761752formatter = formatIterator ;
762753// Handle other regular objects again.
763754} else if ( keys . length === 0 ) {
@@ -818,6 +809,15 @@ function formatRaw(ctx, value, recurseTimes, typedArray) {
818809return 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.
823823let stack = err . stack || ErrorPrototype . toString ( err ) ;
0 commit comments