@@ -400,11 +400,15 @@ function formatValue(ctx, value, recurseTimes) {
400
400
} ) ;
401
401
}
402
402
403
+ var constructor = getConstructorOf ( value ) ;
404
+
403
405
// Some type of object without properties can be shortcutted.
404
406
if ( keys . length === 0 ) {
405
407
if ( typeof value === 'function' ) {
406
- return ctx . stylize ( `[Function${ value . name ? `: ${ value . name } ` : '' } ]` ,
407
- 'special' ) ;
408
+ const ctorName = ( constructor && constructor . name === 'AsyncFunction' ) ?
409
+ 'AsyncFunction' : 'Function' ;
410
+ return ctx . stylize (
411
+ `[${ ctorName } ${ value . name ? `: ${ value . name } ` : '' } ]` , 'special' ) ;
408
412
}
409
413
if ( isRegExp ( value ) ) {
410
414
return ctx . stylize ( RegExp . prototype . toString . call ( value ) , 'regexp' ) ;
@@ -440,12 +444,11 @@ function formatValue(ctx, value, recurseTimes) {
440
444
// Can't do the same for DataView because it has a non-primitive
441
445
// .buffer property that we need to recurse for.
442
446
if ( binding . isArrayBuffer ( value ) || binding . isSharedArrayBuffer ( value ) ) {
443
- return `${ getConstructorOf ( value ) . name } ` +
447
+ return `${ constructor . name } ` +
444
448
` { byteLength: ${ formatNumber ( ctx , value . byteLength ) } }` ;
445
449
}
446
450
}
447
451
448
- var constructor = getConstructorOf ( value ) ;
449
452
var base = '' , empty = false , braces ;
450
453
var formatter = formatObject ;
451
454
@@ -536,7 +539,9 @@ function formatValue(ctx, value, recurseTimes) {
536
539
537
540
// Make functions say that they are functions
538
541
if ( typeof value === 'function' ) {
539
- base = ` [Function${ value . name ? `: ${ value . name } ` : '' } ]` ;
542
+ const ctorName = ( constructor && constructor . name === 'AsyncFunction' ) ?
543
+ 'AsyncFunction' : 'Function' ;
544
+ base = ` [${ ctorName } ${ value . name ? `: ${ value . name } ` : '' } ]` ;
540
545
}
541
546
542
547
// Make RegExps say that they are RegExps
0 commit comments