@@ -79,7 +79,7 @@ const regExpToString = RegExp.prototype.toString;
79
79
const dateToISOString = Date . prototype . toISOString ;
80
80
const errorToString = Error . prototype . toString ;
81
81
82
- var CIRCULAR_ERROR_MESSAGE ;
82
+ let CIRCULAR_ERROR_MESSAGE ;
83
83
84
84
/* eslint-disable */
85
85
const strEscapeSequencesRegExp = / [ \x00 - \x1f \x27 \x5c ] / ;
@@ -119,8 +119,8 @@ function strEscape(str) {
119
119
return `'${ str } '` ;
120
120
if ( str . length > 100 )
121
121
return `'${ str . replace ( strEscapeSequencesReplacer , escapeFn ) } '` ;
122
- var result = '' ;
123
- var last = 0 ;
122
+ let result = '' ;
123
+ let last = 0 ;
124
124
for ( var i = 0 ; i < str . length ; i ++ ) {
125
125
const point = str . charCodeAt ( i ) ;
126
126
if ( point === 39 || point === 92 || point < 32 ) {
@@ -159,10 +159,10 @@ function tryStringify(arg) {
159
159
}
160
160
161
161
function format ( f ) {
162
- var i , tempStr ;
162
+ let i , tempStr ;
163
163
if ( typeof f !== 'string' ) {
164
164
if ( arguments . length === 0 ) return '' ;
165
- var res = '' ;
165
+ let res = '' ;
166
166
for ( i = 0 ; i < arguments . length - 1 ; i ++ ) {
167
167
res += inspect ( arguments [ i ] ) ;
168
168
res += ' ' ;
@@ -173,9 +173,9 @@ function format(f) {
173
173
174
174
if ( arguments . length === 1 ) return f ;
175
175
176
- var str = '' ;
177
- var a = 1 ;
178
- var lastPos = 0 ;
176
+ let str = '' ;
177
+ let a = 1 ;
178
+ let lastPos = 0 ;
179
179
for ( i = 0 ; i < f . length - 1 ; i ++ ) {
180
180
if ( f . charCodeAt ( i ) === 37 ) { // '%'
181
181
const nextChar = f . charCodeAt ( ++ i ) ;
@@ -250,9 +250,9 @@ function debuglog(set) {
250
250
set = set . toUpperCase ( ) ;
251
251
if ( ! debugs [ set ] ) {
252
252
if ( debugEnvRegex . test ( set ) ) {
253
- var pid = process . pid ;
253
+ const pid = process . pid ;
254
254
debugs [ set ] = function ( ) {
255
- var msg = exports . format . apply ( exports , arguments ) ;
255
+ const msg = exports . format . apply ( exports , arguments ) ;
256
256
console . error ( '%s %d: %s' , set , pid , msg ) ;
257
257
} ;
258
258
} else {
@@ -426,8 +426,8 @@ function formatValue(ctx, value, recurseTimes, ln) {
426
426
}
427
427
}
428
428
429
- var keys ;
430
- var symbols = Object . getOwnPropertySymbols ( value ) ;
429
+ let keys ;
430
+ let symbols = Object . getOwnPropertySymbols ( value ) ;
431
431
432
432
// Look up the keys of the object.
433
433
if ( ctx . showHidden ) {
@@ -441,19 +441,19 @@ function formatValue(ctx, value, recurseTimes, ln) {
441
441
const keyLength = keys . length + symbols . length ;
442
442
443
443
const { constructor, tag } = getIdentificationOf ( value ) ;
444
- var prefix = '' ;
444
+ let prefix = '' ;
445
445
if ( constructor && tag && constructor !== tag )
446
446
prefix = `${ constructor } [${ tag } ] ` ;
447
447
else if ( constructor )
448
448
prefix = `${ constructor } ` ;
449
449
else if ( tag )
450
450
prefix = `[${ tag } ] ` ;
451
451
452
- var base = '' ;
453
- var formatter = formatObject ;
454
- var braces ;
455
- var noIterator = true ;
456
- var raw ;
452
+ let base = '' ;
453
+ let formatter = formatObject ;
454
+ let braces ;
455
+ let noIterator = true ;
456
+ let raw ;
457
457
458
458
// Iterators and the rest are split to reduce checks
459
459
if ( value [ Symbol . iterator ] ) {
@@ -623,7 +623,7 @@ function formatPrimitive(fn, value, ctx) {
623
623
// eslint-disable-next-line max-len
624
624
const averageLineLength = Math . ceil ( value . length / Math . ceil ( value . length / minLineLength ) ) ;
625
625
const divisor = Math . max ( averageLineLength , MIN_LINE_LENGTH ) ;
626
- var res = '' ;
626
+ let res = '' ;
627
627
if ( readableRegExps [ divisor ] === undefined ) {
628
628
// Build a new RegExp that naturally breaks text into multiple lines.
629
629
//
@@ -678,8 +678,8 @@ function formatObject(ctx, value, recurseTimes, keys) {
678
678
function formatSpecialArray ( ctx , value , recurseTimes , keys , maxLength , valLen ) {
679
679
const output = [ ] ;
680
680
const keyLen = keys . length ;
681
- var visibleLength = 0 ;
682
- var i = 0 ;
681
+ let visibleLength = 0 ;
682
+ let i = 0 ;
683
683
if ( keyLen !== 0 && numberRegExp . test ( keys [ 0 ] ) ) {
684
684
for ( const key of keys ) {
685
685
if ( visibleLength === maxLength )
@@ -728,7 +728,7 @@ function formatSpecialArray(ctx, value, recurseTimes, keys, maxLength, valLen) {
728
728
} else if ( keys [ keyLen - 1 ] !== `${ valLen - 1 } ` ) {
729
729
const extra = [ ] ;
730
730
// Only handle special keys
731
- var key ;
731
+ let key ;
732
732
for ( i = keys . length - 1 ; i >= 0 ; i -- ) {
733
733
key = keys [ i ] ;
734
734
if ( numberRegExp . test ( key ) && + key < 2 ** 32 - 1 )
@@ -792,7 +792,7 @@ function formatTypedArray(ctx, value, recurseTimes, keys) {
792
792
793
793
function formatSet ( ctx , value , recurseTimes , keys ) {
794
794
const output = new Array ( value . size + keys . length + ( ctx . showHidden ? 1 : 0 ) ) ;
795
- var i = 0 ;
795
+ let i = 0 ;
796
796
for ( const v of value )
797
797
output [ i ++ ] = formatValue ( ctx , v , recurseTimes ) ;
798
798
// With `showHidden`, `length` will display as a hidden property for
@@ -808,7 +808,7 @@ function formatSet(ctx, value, recurseTimes, keys) {
808
808
809
809
function formatMap ( ctx , value , recurseTimes , keys ) {
810
810
const output = new Array ( value . size + keys . length + ( ctx . showHidden ? 1 : 0 ) ) ;
811
- var i = 0 ;
811
+ let i = 0 ;
812
812
for ( const [ k , v ] of value )
813
813
output [ i ++ ] = `${ formatValue ( ctx , k , recurseTimes ) } => ` +
814
814
formatValue ( ctx , v , recurseTimes ) ;
@@ -823,9 +823,9 @@ function formatMap(ctx, value, recurseTimes, keys) {
823
823
824
824
function formatCollectionIterator ( preview , ctx , value , recurseTimes ,
825
825
visibleKeys , keys ) {
826
- var nextRecurseTimes = recurseTimes === null ? null : recurseTimes - 1 ;
827
- var vals = preview ( value , 100 ) ;
828
- var output = [ ] ;
826
+ const nextRecurseTimes = recurseTimes === null ? null : recurseTimes - 1 ;
827
+ const vals = preview ( value , 100 ) ;
828
+ const output = [ ] ;
829
829
for ( const o of vals ) {
830
830
output . push ( formatValue ( ctx , o , nextRecurseTimes ) ) ;
831
831
}
@@ -843,7 +843,7 @@ function formatSetIterator(ctx, value, recurseTimes, visibleKeys, keys) {
843
843
}
844
844
845
845
function formatPromise ( ctx , value , recurseTimes , keys ) {
846
- var output ;
846
+ let output ;
847
847
const [ state , result ] = getPromiseDetails ( value ) ;
848
848
if ( state === kPending ) {
849
849
output = [ '<pending>' ] ;
@@ -858,7 +858,7 @@ function formatPromise(ctx, value, recurseTimes, keys) {
858
858
}
859
859
860
860
function formatProperty ( ctx , value , recurseTimes , key , array ) {
861
- var name , str ;
861
+ let name , str ;
862
862
const desc = Object . getOwnPropertyDescriptor ( value , key ) ||
863
863
{ value : value [ key ] , enumerable : true } ;
864
864
if ( desc . value !== undefined ) {
@@ -895,18 +895,18 @@ function formatProperty(ctx, value, recurseTimes, key, array) {
895
895
896
896
function reduceToSingleString ( ctx , output , base , braces , addLn ) {
897
897
const breakLength = ctx . breakLength ;
898
- var i = 0 ;
898
+ let i = 0 ;
899
899
if ( ctx . compact === false ) {
900
900
const indentation = ' ' . repeat ( ctx . indentationLvl ) ;
901
- var res = `${ base ? `${ base } ` : '' } ${ braces [ 0 ] } \n${ indentation } ` ;
901
+ let res = `${ base ? `${ base } ` : '' } ${ braces [ 0 ] } \n${ indentation } ` ;
902
902
for ( ; i < output . length - 1 ; i ++ ) {
903
903
res += `${ output [ i ] } ,\n${ indentation } ` ;
904
904
}
905
905
res += `${ output [ i ] } \n${ indentation } ${ braces [ 1 ] } ` ;
906
906
return res ;
907
907
}
908
908
if ( output . length * 2 <= breakLength ) {
909
- var length = 0 ;
909
+ let length = 0 ;
910
910
for ( ; i < output . length && length <= breakLength ; i ++ ) {
911
911
if ( ctx . colors ) {
912
912
length += removeColors ( output [ i ] ) . length + 1 ;
@@ -979,10 +979,10 @@ const months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep',
979
979
980
980
// 26 Feb 16:19:34
981
981
function timestamp ( ) {
982
- var d = new Date ( ) ;
983
- var time = [ pad ( d . getHours ( ) ) ,
984
- pad ( d . getMinutes ( ) ) ,
985
- pad ( d . getSeconds ( ) ) ] . join ( ':' ) ;
982
+ const d = new Date ( ) ;
983
+ const time = [ pad ( d . getHours ( ) ) ,
984
+ pad ( d . getMinutes ( ) ) ,
985
+ pad ( d . getSeconds ( ) ) ] . join ( ':' ) ;
986
986
return [ d . getDate ( ) , months [ d . getMonth ( ) ] , time ] . join ( ' ' ) ;
987
987
}
988
988
@@ -1026,8 +1026,8 @@ function _extend(target, source) {
1026
1026
// Don't do anything if source isn't an object
1027
1027
if ( source === null || typeof source !== 'object' ) return target ;
1028
1028
1029
- var keys = Object . keys ( source ) ;
1030
- var i = keys . length ;
1029
+ const keys = Object . keys ( source ) ;
1030
+ let i = keys . length ;
1031
1031
while ( i -- ) {
1032
1032
target [ keys [ i ] ] = source [ keys [ i ] ] ;
1033
1033
}
0 commit comments