@@ -96,7 +96,7 @@ exports.debuglog = function(set) {
96
96
debugEnviron = process . env . NODE_DEBUG || '' ;
97
97
set = set . toUpperCase ( ) ;
98
98
if ( ! debugs [ set ] ) {
99
- if ( new RegExp ( ' \\b' + set + ' \\b' , 'i' ) . test ( debugEnviron ) ) {
99
+ if ( new RegExp ( ` \\b${ set } \\b` , 'i' ) . test ( debugEnviron ) ) {
100
100
var pid = process . pid ;
101
101
debugs [ set ] = function ( ) {
102
102
var msg = exports . format . apply ( exports , arguments ) ;
@@ -181,8 +181,8 @@ function stylizeWithColor(str, styleType) {
181
181
var style = inspect . styles [ styleType ] ;
182
182
183
183
if ( style ) {
184
- return ' \u001b[' + inspect . colors [ style ] [ 0 ] + 'm' + str +
185
- ' \u001b[' + inspect . colors [ style ] [ 1 ] + 'm' ;
184
+ return ` \u001b[${ inspect . colors [ style ] [ 0 ] } m ${ str } ` +
185
+ ` \u001b[${ inspect . colors [ style ] [ 1 ] } m` ;
186
186
} else {
187
187
return str ;
188
188
}
@@ -297,8 +297,8 @@ function formatValue(ctx, value, recurseTimes) {
297
297
// Some type of object without properties can be shortcutted.
298
298
if ( keys . length === 0 ) {
299
299
if ( typeof value === 'function' ) {
300
- var name = value . name ? ': ' + value . name : '' ;
301
- return ctx . stylize ( '[Function' + name + ']' , 'special' ) ;
300
+ return ctx . stylize ( `[Function ${ value . name ? `: ${ value . name } ` : '' } ]` ,
301
+ 'special' ) ;
302
302
}
303
303
if ( isRegExp ( value ) ) {
304
304
return ctx . stylize ( RegExp . prototype . toString . call ( value ) , 'regexp' ) ;
@@ -312,19 +312,19 @@ function formatValue(ctx, value, recurseTimes) {
312
312
// now check the `raw` value to handle boxed primitives
313
313
if ( typeof raw === 'string' ) {
314
314
formatted = formatPrimitiveNoColor ( ctx , raw ) ;
315
- return ctx . stylize ( ' [String: ' + formatted + ']' , 'string' ) ;
315
+ return ctx . stylize ( ` [String: ${ formatted } ]` , 'string' ) ;
316
316
}
317
317
if ( typeof raw === 'symbol' ) {
318
318
formatted = formatPrimitiveNoColor ( ctx , raw ) ;
319
- return ctx . stylize ( ' [Symbol: ' + formatted + ']' , 'symbol' ) ;
319
+ return ctx . stylize ( ` [Symbol: ${ formatted } ]` , 'symbol' ) ;
320
320
}
321
321
if ( typeof raw === 'number' ) {
322
322
formatted = formatPrimitiveNoColor ( ctx , raw ) ;
323
- return ctx . stylize ( ' [Number: ' + formatted + ']' , 'number' ) ;
323
+ return ctx . stylize ( ` [Number: ${ formatted } ]` , 'number' ) ;
324
324
}
325
325
if ( typeof raw === 'boolean' ) {
326
326
formatted = formatPrimitiveNoColor ( ctx , raw ) ;
327
- return ctx . stylize ( ' [Boolean: ' + formatted + ']' , 'boolean' ) ;
327
+ return ctx . stylize ( ` [Boolean: ${ formatted } ]` , 'boolean' ) ;
328
328
}
329
329
}
330
330
@@ -390,8 +390,7 @@ function formatValue(ctx, value, recurseTimes) {
390
390
391
391
// Make functions say that they are functions
392
392
if ( typeof value === 'function' ) {
393
- var n = value . name ? ': ' + value . name : '' ;
394
- base = ' [Function' + n + ']' ;
393
+ base = ` [Function${ value . name ? `: ${ value . name } ` : '' } ]` ;
395
394
}
396
395
397
396
// Make RegExps say that they are RegExps
@@ -412,24 +411,24 @@ function formatValue(ctx, value, recurseTimes) {
412
411
// Make boxed primitive Strings look like such
413
412
if ( typeof raw === 'string' ) {
414
413
formatted = formatPrimitiveNoColor ( ctx , raw ) ;
415
- base = ' ' + ' [String: ' + formatted + ']' ;
414
+ base = ` [String: ${ formatted } ]` ;
416
415
}
417
416
418
417
// Make boxed primitive Numbers look like such
419
418
if ( typeof raw === 'number' ) {
420
419
formatted = formatPrimitiveNoColor ( ctx , raw ) ;
421
- base = ' ' + ' [Number: ' + formatted + ']' ;
420
+ base = ` [Number: ${ formatted } ]` ;
422
421
}
423
422
424
423
// Make boxed primitive Booleans look like such
425
424
if ( typeof raw === 'boolean' ) {
426
425
formatted = formatPrimitiveNoColor ( ctx , raw ) ;
427
- base = ' ' + ' [Boolean: ' + formatted + ']' ;
426
+ base = ` [Boolean: ${ formatted } ]` ;
428
427
}
429
428
430
429
// Add constructor name if available
431
430
if ( base === '' && constructor )
432
- braces [ 0 ] = constructor . name + ' ' + braces [ 0 ] ;
431
+ braces [ 0 ] = ` ${ constructor . name } ${ braces [ 0 ] } ` ;
433
432
434
433
if ( empty === true ) {
435
434
return braces [ 0 ] + base + braces [ 1 ] ;
@@ -497,7 +496,7 @@ function formatPrimitiveNoColor(ctx, value) {
497
496
498
497
499
498
function formatError ( value ) {
500
- return '[' + Error . prototype . toString . call ( value ) + ']' ;
499
+ return `[ ${ Error . prototype . toString . call ( value ) } ]` ;
501
500
}
502
501
503
502
@@ -609,9 +608,9 @@ function formatProperty(ctx, value, recurseTimes, visibleKeys, key, array) {
609
608
}
610
609
if ( ! hasOwnProperty ( visibleKeys , key ) ) {
611
610
if ( typeof key === 'symbol' ) {
612
- name = '[' + ctx . stylize ( key . toString ( ) , 'symbol' ) + ']' ;
611
+ name = `[ ${ ctx . stylize ( key . toString ( ) , 'symbol' ) } ]` ;
613
612
} else {
614
- name = '[' + key + ']' ;
613
+ name = `[ ${ key } ]` ;
615
614
}
616
615
}
617
616
if ( ! str ) {
@@ -649,7 +648,7 @@ function formatProperty(ctx, value, recurseTimes, visibleKeys, key, array) {
649
648
}
650
649
}
651
650
652
- return name + ': ' + str ;
651
+ return ` ${ name } : ${ str } ` ;
653
652
}
654
653
655
654
@@ -664,13 +663,10 @@ function reduceToSingleString(output, base, braces) {
664
663
// we need to force the first item to be on the next line or the
665
664
// items will not line up correctly.
666
665
( base === '' && braces [ 0 ] . length === 1 ? '' : base + '\n ' ) +
667
- ' ' +
668
- output . join ( ',\n ' ) +
669
- ' ' +
670
- braces [ 1 ] ;
666
+ ` ${ output . join ( ',\n ' ) } ${ braces [ 1 ] } ` ;
671
667
}
672
668
673
- return braces [ 0 ] + base + ' ' + output . join ( ', ' ) + ' ' + braces [ 1 ] ;
669
+ return ` ${ braces [ 0 ] } ${ base } ${ output . join ( ', ' ) } ${ braces [ 1 ] } ` ;
674
670
}
675
671
676
672
@@ -854,7 +850,7 @@ exports.puts = internalUtil.deprecate(function() {
854
850
855
851
856
852
exports . debug = internalUtil . deprecate ( function ( x ) {
857
- process . stderr . write ( ' DEBUG: ' + x + '\n' ) ;
853
+ process . stderr . write ( ` DEBUG: ${ x } \n` ) ;
858
854
} , 'util.debug is deprecated. Use console.error instead.' ) ;
859
855
860
856
@@ -905,7 +901,7 @@ exports.pump = internalUtil.deprecate(function(readStream, writeStream, cb) {
905
901
906
902
exports . _errnoException = function ( err , syscall , original ) {
907
903
var errname = uv . errname ( err ) ;
908
- var message = syscall + ' ' + errname ;
904
+ var message = ` ${ syscall } ${ errname } ` ;
909
905
if ( original )
910
906
message += ' ' + original ;
911
907
var e = new Error ( message ) ;
@@ -923,13 +919,13 @@ exports._exceptionWithHostPort = function(err,
923
919
additional ) {
924
920
var details ;
925
921
if ( port && port > 0 ) {
926
- details = address + ':' + port ;
922
+ details = ` ${ address } : ${ port } ` ;
927
923
} else {
928
924
details = address ;
929
925
}
930
926
931
927
if ( additional ) {
932
- details += ' - Local (' + additional + ')' ;
928
+ details += ` - Local (${ additional } )` ;
933
929
}
934
930
var ex = exports . _errnoException ( err , syscall , details ) ;
935
931
ex . address = address ;
0 commit comments