@@ -202,7 +202,7 @@ function stylizeWithColor(str, styleType) {
202
202
203
203
if ( style ) {
204
204
return '\u001b[' + inspect . colors [ style ] [ 0 ] + 'm' + str +
205
- '\u001b[' + inspect . colors [ style ] [ 1 ] + 'm' ;
205
+ '\u001b[' + inspect . colors [ style ] [ 1 ] + 'm' ;
206
206
} else {
207
207
return str ;
208
208
}
@@ -229,12 +229,12 @@ function formatValue(ctx, value, recurseTimes) {
229
229
// Provide a hook for user-specified inspect functions.
230
230
// Check that value is an object with an inspect function on it
231
231
if ( ctx . customInspect &&
232
- value &&
233
- isFunction ( value . inspect ) &&
234
- // Filter out the util module, it's inspect function is special
235
- value . inspect !== exports . inspect &&
236
- // Also filter out any prototype objects using the circular check.
237
- ! ( value . constructor && value . constructor . prototype === value ) ) {
232
+ value &&
233
+ isFunction ( value . inspect ) &&
234
+ // Filter out the util module, it's inspect function is special
235
+ value . inspect !== exports . inspect &&
236
+ // Also filter out any prototype objects using the circular check.
237
+ ! ( value . constructor && value . constructor . prototype === value ) ) {
238
238
var ret = value . inspect ( recurseTimes , ctx ) ;
239
239
if ( ! isString ( ret ) ) {
240
240
ret = formatValue ( ctx , ret , recurseTimes ) ;
@@ -259,7 +259,7 @@ function formatValue(ctx, value, recurseTimes) {
259
259
// IE doesn't make error fields non-enumerable
260
260
// http://msdn.microsoft.com/en-us/library/ie/dww52sbt(v=vs.94).aspx
261
261
if ( isError ( value )
262
- && ( keys . indexOf ( 'message' ) >= 0 || keys . indexOf ( 'description' ) >= 0 ) ) {
262
+ && ( keys . indexOf ( 'message' ) >= 0 || keys . indexOf ( 'description' ) >= 0 ) ) {
263
263
return formatError ( value ) ;
264
264
}
265
265
@@ -343,8 +343,8 @@ function formatPrimitive(ctx, value) {
343
343
return ctx . stylize ( 'undefined' , 'undefined' ) ;
344
344
if ( isString ( value ) ) {
345
345
var simple = '\'' + JSON . stringify ( value ) . replace ( / ^ " | " $ / g, '' )
346
- . replace ( / ' / g, "\\'" )
347
- . replace ( / \\ " / g, '"' ) + '\'' ;
346
+ . replace ( / ' / g, "\\'" )
347
+ . replace ( / \\ " / g, '"' ) + '\'' ;
348
348
return ctx . stylize ( simple , 'string' ) ;
349
349
}
350
350
if ( isNumber ( value ) )
@@ -367,15 +367,15 @@ function formatArray(ctx, value, recurseTimes, visibleKeys, keys) {
367
367
for ( var i = 0 , l = value . length ; i < l ; ++ i ) {
368
368
if ( hasOwnProperty ( value , String ( i ) ) ) {
369
369
output . push ( formatProperty ( ctx , value , recurseTimes , visibleKeys ,
370
- String ( i ) , true ) ) ;
370
+ String ( i ) , true ) ) ;
371
371
} else {
372
372
output . push ( '' ) ;
373
373
}
374
374
}
375
375
keys . forEach ( function ( key ) {
376
376
if ( ! key . match ( / ^ \d + $ / ) ) {
377
377
output . push ( formatProperty ( ctx , value , recurseTimes , visibleKeys ,
378
- key , true ) ) ;
378
+ key , true ) ) ;
379
379
}
380
380
} ) ;
381
381
return output ;
@@ -431,8 +431,8 @@ function formatProperty(ctx, value, recurseTimes, visibleKeys, key, array) {
431
431
name = ctx . stylize ( name , 'name' ) ;
432
432
} else {
433
433
name = name . replace ( / ' / g, "\\'" )
434
- . replace ( / \\ " / g, '"' )
435
- . replace ( / ( ^ " | " $ ) / g, "'" ) ;
434
+ . replace ( / \\ " / g, '"' )
435
+ . replace ( / ( ^ " | " $ ) / g, "'" ) ;
436
436
name = ctx . stylize ( name , 'string' ) ;
437
437
}
438
438
}
@@ -451,11 +451,11 @@ function reduceToSingleString(output, base, braces) {
451
451
452
452
if ( length > 60 ) {
453
453
return braces [ 0 ] +
454
- ( base === '' ? '' : base + '\n ' ) +
455
- ' ' +
456
- output . join ( ',\n ' ) +
457
- ' ' +
458
- braces [ 1 ] ;
454
+ ( base === '' ? '' : base + '\n ' ) +
455
+ ' ' +
456
+ output . join ( ',\n ' ) +
457
+ ' ' +
458
+ braces [ 1 ] ;
459
459
}
460
460
461
461
return braces [ 0 ] + base + ' ' + output . join ( ', ' ) + ' ' + braces [ 1 ] ;
@@ -525,7 +525,7 @@ exports.types.isDate = isDate;
525
525
526
526
function isError ( e ) {
527
527
return isObject ( e ) &&
528
- ( objectToString ( e ) === '[object Error]' || e instanceof Error ) ;
528
+ ( objectToString ( e ) === '[object Error]' || e instanceof Error ) ;
529
529
}
530
530
exports . isError = isError ;
531
531
exports . types . isNativeError = isError ;
@@ -537,11 +537,11 @@ exports.isFunction = isFunction;
537
537
538
538
function isPrimitive ( arg ) {
539
539
return arg === null ||
540
- typeof arg === 'boolean' ||
541
- typeof arg === 'number' ||
542
- typeof arg === 'string' ||
543
- typeof arg === 'symbol' || // ES6 symbol
544
- typeof arg === 'undefined' ;
540
+ typeof arg === 'boolean' ||
541
+ typeof arg === 'number' ||
542
+ typeof arg === 'string' ||
543
+ typeof arg === 'symbol' || // ES6 symbol
544
+ typeof arg === 'undefined' ;
545
545
}
546
546
exports . isPrimitive = isPrimitive ;
547
547
@@ -558,14 +558,14 @@ function pad(n) {
558
558
559
559
560
560
var months = [ 'Jan' , 'Feb' , 'Mar' , 'Apr' , 'May' , 'Jun' , 'Jul' , 'Aug' , 'Sep' ,
561
- 'Oct' , 'Nov' , 'Dec' ] ;
561
+ 'Oct' , 'Nov' , 'Dec' ] ;
562
562
563
563
// 26 Feb 16:19:34
564
564
function timestamp ( ) {
565
565
var d = new Date ( ) ;
566
566
var time = [ pad ( d . getHours ( ) ) ,
567
- pad ( d . getMinutes ( ) ) ,
568
- pad ( d . getSeconds ( ) ) ] . join ( ':' ) ;
567
+ pad ( d . getMinutes ( ) ) ,
568
+ pad ( d . getSeconds ( ) ) ] . join ( ':' ) ;
569
569
return [ d . getDate ( ) , months [ d . getMonth ( ) ] , time ] . join ( ' ' ) ;
570
570
}
571
571
@@ -704,12 +704,13 @@ function callbackify(original) {
704
704
// implications (stack, `uncaughtException`, `async_hooks`)
705
705
original . apply ( this , args )
706
706
. then ( function ( ret ) { process . nextTick ( cb . bind ( null , null , ret ) ) } ,
707
- function ( rej ) { process . nextTick ( callbackifyOnRejected . bind ( null , rej , cb ) ) } ) ;
707
+ function ( rej ) { process . nextTick ( callbackifyOnRejected . bind ( null , rej , cb ) ) } ) ;
708
708
}
709
709
710
710
Object . setPrototypeOf ( callbackified , Object . getPrototypeOf ( original ) ) ;
711
- Object . defineProperties ( callbackified ,
712
- getOwnPropertyDescriptors ( original ) ) ;
711
+ const desc = getOwnPropertyDescriptors ( original ) ;
712
+ desc . length . value += 1 ;
713
+ Object . defineProperties ( callbackified , desc ) ;
713
714
return callbackified ;
714
715
}
715
716
exports . callbackify = callbackify ;
0 commit comments