@@ -463,28 +463,22 @@ function clazzWithNullPrototype(clazz, name) {
463
463
function noPrototypeIterator ( ctx , value , recurseTimes ) {
464
464
let newVal ;
465
465
if ( isSet ( value ) ) {
466
- const clazz = Object . getPrototypeOf ( value ) ||
467
- clazzWithNullPrototype ( Set , 'Set' ) ;
466
+ const clazz = clazzWithNullPrototype ( Set , 'Set' ) ;
468
467
newVal = new clazz ( setValues ( value ) ) ;
469
468
} else if ( isMap ( value ) ) {
470
- const clazz = Object . getPrototypeOf ( value ) ||
471
- clazzWithNullPrototype ( Map , 'Map' ) ;
469
+ const clazz = clazzWithNullPrototype ( Map , 'Map' ) ;
472
470
newVal = new clazz ( mapEntries ( value ) ) ;
473
471
} else if ( Array . isArray ( value ) ) {
474
- const clazz = Object . getPrototypeOf ( value ) ||
475
- clazzWithNullPrototype ( Array , 'Array' ) ;
472
+ const clazz = clazzWithNullPrototype ( Array , 'Array' ) ;
476
473
newVal = new clazz ( value . length ) ;
477
474
} 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 ) ;
483
477
newVal = new clazz ( value ) ;
484
478
}
485
- if ( newVal ) {
479
+ if ( newVal !== undefined ) {
486
480
Object . defineProperties ( newVal , Object . getOwnPropertyDescriptors ( value ) ) ;
487
- return formatValue ( ctx , newVal , recurseTimes ) ;
481
+ return formatRaw ( ctx , newVal , recurseTimes ) ;
488
482
}
489
483
}
490
484
@@ -728,9 +722,11 @@ function formatRaw(ctx, value, recurseTimes, typedArray) {
728
722
} else {
729
723
// The input prototype got manipulated. Special handle these. We have to
730
724
// 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
+ }
734
730
}
735
731
if ( isMapIterator ( value ) ) {
736
732
braces = [ `[${ tag || 'Map Iterator' } ] {` , '}' ] ;
0 commit comments