@@ -463,28 +463,22 @@ function clazzWithNullPrototype(clazz, name) {
463463function noPrototypeIterator ( ctx , value , recurseTimes ) {
464464 let newVal ;
465465 if ( isSet ( value ) ) {
466- const clazz = Object . getPrototypeOf ( value ) ||
467- clazzWithNullPrototype ( Set , 'Set' ) ;
466+ const clazz = clazzWithNullPrototype ( Set , 'Set' ) ;
468467 newVal = new clazz ( setValues ( value ) ) ;
469468 } else if ( isMap ( value ) ) {
470- const clazz = Object . getPrototypeOf ( value ) ||
471- clazzWithNullPrototype ( Map , 'Map' ) ;
469+ const clazz = clazzWithNullPrototype ( Map , 'Map' ) ;
472470 newVal = new clazz ( mapEntries ( value ) ) ;
473471 } else if ( Array . isArray ( value ) ) {
474- const clazz = Object . getPrototypeOf ( value ) ||
475- clazzWithNullPrototype ( Array , 'Array' ) ;
472+ const clazz = clazzWithNullPrototype ( Array , 'Array' ) ;
476473 newVal = new clazz ( value . length ) ;
477474 } else if ( isTypedArray ( value ) ) {
478- let clazz = Object . getPrototypeOf ( value ) ;
479- if ( ! clazz ) {
480- const constructor = findTypedConstructor ( value ) ;
481- clazz = clazzWithNullPrototype ( constructor , constructor . name ) ;
482- }
475+ const constructor = findTypedConstructor ( value ) ;
476+ const clazz = clazzWithNullPrototype ( constructor , constructor . name ) ;
483477 newVal = new clazz ( value ) ;
484478 }
485- if ( newVal ) {
479+ if ( newVal !== undefined ) {
486480 Object . defineProperties ( newVal , Object . getOwnPropertyDescriptors ( value ) ) ;
487- return formatValue ( ctx , newVal , recurseTimes ) ;
481+ return formatRaw ( ctx , newVal , recurseTimes ) ;
488482 }
489483}
490484
@@ -728,9 +722,11 @@ function formatRaw(ctx, value, recurseTimes, typedArray) {
728722 } else {
729723 // The input prototype got manipulated. Special handle these. We have to
730724 // rebuild the information so we are able to display everything.
731- const specialIterator = noPrototypeIterator ( ctx , value , recurseTimes ) ;
732- if ( specialIterator ) {
733- return specialIterator ;
725+ if ( constructor === null ) {
726+ const specialIterator = noPrototypeIterator ( ctx , value , recurseTimes ) ;
727+ if ( specialIterator ) {
728+ return specialIterator ;
729+ }
734730 }
735731 if ( isMapIterator ( value ) ) {
736732 braces = [ `[${ tag || 'Map Iterator' } ] {` , '}' ] ;
0 commit comments