@@ -15,10 +15,15 @@ var weakRefDeref = hasWeakRef ? WeakRef.prototype.deref : null;
15
15
var booleanValueOf = Boolean . prototype . valueOf ;
16
16
var objectToString = Object . prototype . toString ;
17
17
var functionToString = Function . prototype . toString ;
18
- var match = String . prototype . match ;
18
+ var $ match = String . prototype . match ;
19
19
var $slice = String . prototype . slice ;
20
20
var $replace = String . prototype . replace ;
21
- var test = RegExp . prototype . test ;
21
+ var $toUpperCase = String . prototype . toUpperCase ;
22
+ var $toLowerCase = String . prototype . toLowerCase ;
23
+ var $test = RegExp . prototype . test ;
24
+ var $concat = Array . prototype . concat ;
25
+ var $join = Array . prototype . join ;
26
+ var $arrSlice = Array . prototype . slice ;
22
27
var $floor = Math . floor ;
23
28
var bigIntValueOf = typeof BigInt === 'function' ? BigInt . prototype . valueOf : null ;
24
29
var gOPS = Object . getOwnPropertySymbols ;
@@ -44,7 +49,7 @@ function addNumericSeparator(num, str) {
44
49
|| num === - Infinity
45
50
|| num !== num
46
51
|| ( num && num > - 1000 && num < 1000 )
47
- || test . call ( / e / , str )
52
+ || $ test. call ( / e / , str )
48
53
) {
49
54
return str ;
50
55
}
@@ -136,7 +141,7 @@ module.exports = function inspect_(obj, options, depth, seen) {
136
141
137
142
function inspect ( value , from , noIndent ) {
138
143
if ( from ) {
139
- seen = seen . slice ( ) ;
144
+ seen = $arrSlice . call ( seen ) ;
140
145
seen . push ( from ) ;
141
146
}
142
147
if ( noIndent ) {
@@ -154,21 +159,21 @@ module.exports = function inspect_(obj, options, depth, seen) {
154
159
if ( typeof obj === 'function' ) {
155
160
var name = nameOf ( obj ) ;
156
161
var keys = arrObjKeys ( obj , inspect ) ;
157
- return '[Function' + ( name ? ': ' + name : ' (anonymous)' ) + ']' + ( keys . length > 0 ? ' { ' + keys . join ( ', ' ) + ' }' : '' ) ;
162
+ return '[Function' + ( name ? ': ' + name : ' (anonymous)' ) + ']' + ( keys . length > 0 ? ' { ' + $ join. call ( keys , ', ' ) + ' }' : '' ) ;
158
163
}
159
164
if ( isSymbol ( obj ) ) {
160
- var symString = hasShammedSymbols ? String ( obj ) . replace ( / ^ ( S y m b o l \( .* \) ) _ [ ^ ) ] * $ / , '$1' ) : symToString . call ( obj ) ;
165
+ var symString = hasShammedSymbols ? $replace . call ( String ( obj ) , / ^ ( S y m b o l \( .* \) ) _ [ ^ ) ] * $ / , '$1' ) : symToString . call ( obj ) ;
161
166
return typeof obj === 'object' && ! hasShammedSymbols ? markBoxed ( symString ) : symString ;
162
167
}
163
168
if ( isElement ( obj ) ) {
164
- var s = '<' + String ( obj . nodeName ) . toLowerCase ( ) ;
169
+ var s = '<' + $toLowerCase . call ( String ( obj . nodeName ) ) ;
165
170
var attrs = obj . attributes || [ ] ;
166
171
for ( var i = 0 ; i < attrs . length ; i ++ ) {
167
172
s += ' ' + attrs [ i ] . name + '=' + wrapQuotes ( quote ( attrs [ i ] . value ) , 'double' , opts ) ;
168
173
}
169
174
s += '>' ;
170
175
if ( obj . childNodes && obj . childNodes . length ) { s += '...' ; }
171
- s += '</' + String ( obj . nodeName ) . toLowerCase ( ) + '>' ;
176
+ s += '</' + $toLowerCase . call ( String ( obj . nodeName ) ) + '>' ;
172
177
return s ;
173
178
}
174
179
if ( isArray ( obj ) ) {
@@ -177,12 +182,12 @@ module.exports = function inspect_(obj, options, depth, seen) {
177
182
if ( indent && ! singleLineValues ( xs ) ) {
178
183
return '[' + indentedJoin ( xs , indent ) + ']' ;
179
184
}
180
- return '[ ' + xs . join ( ', ' ) + ' ]' ;
185
+ return '[ ' + $ join. call ( xs , ', ' ) + ' ]' ;
181
186
}
182
187
if ( isError ( obj ) ) {
183
188
var parts = arrObjKeys ( obj , inspect ) ;
184
189
if ( parts . length === 0 ) { return '[' + String ( obj ) + ']' ; }
185
- return '{ [' + String ( obj ) + '] ' + parts . join ( ', ' ) + ' }' ;
190
+ return '{ [' + String ( obj ) + '] ' + $ join. call ( parts , ', ' ) + ' }' ;
186
191
}
187
192
if ( typeof obj === 'object' && customInspect ) {
188
193
if ( inspectSymbol && typeof obj [ inspectSymbol ] === 'function' ) {
@@ -230,14 +235,14 @@ module.exports = function inspect_(obj, options, depth, seen) {
230
235
var ys = arrObjKeys ( obj , inspect ) ;
231
236
var isPlainObject = gPO ? gPO ( obj ) === Object . prototype : obj instanceof Object || obj . constructor === Object ;
232
237
var protoTag = obj instanceof Object ? '' : 'null prototype' ;
233
- var stringTag = ! isPlainObject && toStringTag && Object ( obj ) === obj && toStringTag in obj ? toStr ( obj ) . slice ( 8 , - 1 ) : protoTag ? 'Object' : '' ;
238
+ var stringTag = ! isPlainObject && toStringTag && Object ( obj ) === obj && toStringTag in obj ? $slice . call ( toStr ( obj ) , 8 , - 1 ) : protoTag ? 'Object' : '' ;
234
239
var constructorTag = isPlainObject || typeof obj . constructor !== 'function' ? '' : obj . constructor . name ? obj . constructor . name + ' ' : '' ;
235
- var tag = constructorTag + ( stringTag || protoTag ? '[' + [ ] . concat ( stringTag || [ ] , protoTag || [ ] ) . join ( ': ' ) + '] ' : '' ) ;
240
+ var tag = constructorTag + ( stringTag || protoTag ? '[' + $join . call ( $ concat. call ( [ ] , stringTag || [ ] , protoTag || [ ] ) , ': ' ) + '] ' : '' ) ;
236
241
if ( ys . length === 0 ) { return tag + '{}' ; }
237
242
if ( indent ) {
238
243
return tag + '{' + indentedJoin ( ys , indent ) + '}' ;
239
244
}
240
- return tag + '{ ' + ys . join ( ', ' ) + ' }' ;
245
+ return tag + '{ ' + $ join. call ( ys , ', ' ) + ' }' ;
241
246
}
242
247
return String ( obj ) ;
243
248
} ;
@@ -248,7 +253,7 @@ function wrapQuotes(s, defaultStyle, opts) {
248
253
}
249
254
250
255
function quote ( s ) {
251
- return String ( s ) . replace ( / " / g, '"' ) ;
256
+ return $replace . call ( String ( s ) , / " / g, '"' ) ;
252
257
}
253
258
254
259
function isArray ( obj ) { return toStr ( obj ) === '[object Array]' && ( ! toStringTag || ! ( typeof obj === 'object' && toStringTag in obj ) ) ; }
@@ -299,7 +304,7 @@ function toStr(obj) {
299
304
300
305
function nameOf ( f ) {
301
306
if ( f . name ) { return f . name ; }
302
- var m = match . call ( functionToString . call ( f ) , / ^ f u n c t i o n \s * ( [ \w $ ] + ) / ) ;
307
+ var m = $ match. call ( functionToString . call ( f ) , / ^ f u n c t i o n \s * ( [ \w $ ] + ) / ) ;
303
308
if ( m ) { return m [ 1 ] ; }
304
309
return null ;
305
310
}
@@ -399,10 +404,10 @@ function inspectString(str, opts) {
399
404
if ( str . length > opts . maxStringLength ) {
400
405
var remaining = str . length - opts . maxStringLength ;
401
406
var trailer = '... ' + remaining + ' more character' + ( remaining > 1 ? 's' : '' ) ;
402
- return inspectString ( str . slice ( 0 , opts . maxStringLength ) , opts ) + trailer ;
407
+ return inspectString ( $ slice. call ( str , 0 , opts . maxStringLength ) , opts ) + trailer ;
403
408
}
404
409
// eslint-disable-next-line no-control-regex
405
- var s = str . replace ( / ( [ ' \\ ] ) / g, '\\$1' ) . replace ( / [ \x00 - \x1f ] / g, lowbyte ) ;
410
+ var s = $replace . call ( $ replace. call ( str , / ( [ ' \\ ] ) / g, '\\$1' ) , / [ \x00 - \x1f ] / g, lowbyte ) ;
406
411
return wrapQuotes ( s , 'single' , opts ) ;
407
412
}
408
413
@@ -416,7 +421,7 @@ function lowbyte(c) {
416
421
13 : 'r'
417
422
} [ n ] ;
418
423
if ( x ) { return '\\' + x ; }
419
- return '\\x' + ( n < 0x10 ? '0' : '' ) + n . toString ( 16 ) . toUpperCase ( ) ;
424
+ return '\\x' + ( n < 0x10 ? '0' : '' ) + $toUpperCase . call ( n . toString ( 16 ) ) ;
420
425
}
421
426
422
427
function markBoxed ( str ) {
@@ -428,7 +433,7 @@ function weakCollectionOf(type) {
428
433
}
429
434
430
435
function collectionOf ( type , size , entries , indent ) {
431
- var joinedEntries = indent ? indentedJoin ( entries , indent ) : entries . join ( ', ' ) ;
436
+ var joinedEntries = indent ? indentedJoin ( entries , indent ) : $ join. call ( entries , ', ' ) ;
432
437
return type + ' (' + size + ') {' + joinedEntries + '}' ;
433
438
}
434
439
@@ -446,20 +451,20 @@ function getIndent(opts, depth) {
446
451
if ( opts . indent === '\t' ) {
447
452
baseIndent = '\t' ;
448
453
} else if ( typeof opts . indent === 'number' && opts . indent > 0 ) {
449
- baseIndent = Array ( opts . indent + 1 ) . join ( ' ' ) ;
454
+ baseIndent = $join . call ( Array ( opts . indent + 1 ) , ' ' ) ;
450
455
} else {
451
456
return null ;
452
457
}
453
458
return {
454
459
base : baseIndent ,
455
- prev : Array ( depth + 1 ) . join ( baseIndent )
460
+ prev : $join . call ( Array ( depth + 1 ) , baseIndent )
456
461
} ;
457
462
}
458
463
459
464
function indentedJoin ( xs , indent ) {
460
465
if ( xs . length === 0 ) { return '' ; }
461
466
var lineJoiner = '\n' + indent . prev + indent . base ;
462
- return lineJoiner + xs . join ( ',' + lineJoiner ) + '\n' + indent . prev ;
467
+ return lineJoiner + $ join. call ( xs , ',' + lineJoiner ) + '\n' + indent . prev ;
463
468
}
464
469
465
470
function arrObjKeys ( obj , inspect ) {
@@ -486,7 +491,7 @@ function arrObjKeys(obj, inspect) {
486
491
if ( hasShammedSymbols && symMap [ '$' + key ] instanceof Symbol ) {
487
492
// this is to prevent shammed Symbols, which are stored as strings, from being included in the string key section
488
493
continue ; // eslint-disable-line no-restricted-syntax, no-continue
489
- } else if ( test . call ( / [ ^ \w $ ] / , key ) ) {
494
+ } else if ( $ test. call ( / [ ^ \w $ ] / , key ) ) {
490
495
xs . push ( inspect ( key , obj ) + ': ' + inspect ( obj [ key ] , obj ) ) ;
491
496
} else {
492
497
xs . push ( key + ': ' + inspect ( obj [ key ] , obj ) ) ;
0 commit comments