@@ -49,6 +49,7 @@ const {
49
49
ObjectSetPrototypeOf,
50
50
ReflectOwnKeys,
51
51
RegExp,
52
+ RegExpPrototypeSymbolReplace,
52
53
RegExpPrototypeTest,
53
54
RegExpPrototypeToString,
54
55
SafeStringIterator,
@@ -64,7 +65,6 @@ const {
64
65
StringPrototypePadEnd,
65
66
StringPrototypePadStart,
66
67
StringPrototypeRepeat,
67
- StringPrototypeReplace,
68
68
StringPrototypeSlice,
69
69
StringPrototypeSplit,
70
70
StringPrototypeToLowerCase,
@@ -498,7 +498,7 @@ function strEscape(str) {
498
498
if ( str . length < 5000 && ! RegExpPrototypeTest ( escapeTest , str ) )
499
499
return addQuotes ( str , singleQuote ) ;
500
500
if ( str . length > 100 ) {
501
- str = StringPrototypeReplace ( str , escapeReplace , escapeFn ) ;
501
+ str = RegExpPrototypeSymbolReplace ( escapeReplace , str , escapeFn ) ;
502
502
return addQuotes ( str , singleQuote ) ;
503
503
}
504
504
@@ -1458,9 +1458,9 @@ function handleMaxCallStackSize(ctx, err, constructorName, indentationLvl) {
1458
1458
}
1459
1459
1460
1460
function addNumericSeparator ( integerString ) {
1461
- return StringPrototypeReplace (
1462
- integerString ,
1461
+ return RegExpPrototypeSymbolReplace (
1463
1462
/ [ 0 - 9 ] (? = (?: [ 0 - 9 ] { 3 } ) + (? ! [ 0 - 9 ] ) ) / g,
1463
+ integerString ,
1464
1464
'$&_'
1465
1465
) ;
1466
1466
}
@@ -1619,9 +1619,11 @@ function formatArrayBuffer(ctx, value) {
1619
1619
}
1620
1620
if ( hexSlice === undefined )
1621
1621
hexSlice = uncurryThis ( require ( 'buffer' ) . Buffer . prototype . hexSlice ) ;
1622
- let str = StringPrototypeTrim ( StringPrototypeReplace (
1622
+ let str = StringPrototypeTrim ( RegExpPrototypeSymbolReplace (
1623
+ / ( .{ 2 } ) / g,
1623
1624
hexSlice ( buffer , 0 , MathMin ( ctx . maxArrayLength , buffer . length ) ) ,
1624
- / ( .{ 2 } ) / g, '$1 ' ) ) ;
1625
+ '$1 '
1626
+ ) ) ;
1625
1627
const remaining = buffer . length - ctx . maxArrayLength ;
1626
1628
if ( remaining > 0 )
1627
1629
str += ` ... ${ remaining } more byte${ remaining > 1 ? 's' : '' } ` ;
@@ -1853,16 +1855,20 @@ function formatProperty(ctx, value, recurseTimes, key, type, desc,
1853
1855
return str ;
1854
1856
}
1855
1857
if ( typeof key === 'symbol' ) {
1856
- const tmp = StringPrototypeReplace (
1858
+ const tmp = RegExpPrototypeSymbolReplace (
1859
+ strEscapeSequencesReplacer ,
1857
1860
SymbolPrototypeToString ( key ) ,
1858
- strEscapeSequencesReplacer , escapeFn
1861
+ escapeFn
1859
1862
) ;
1860
1863
name = `[${ ctx . stylize ( tmp , 'symbol' ) } ]` ;
1861
1864
} else if ( key === '__proto__' ) {
1862
1865
name = "['__proto__']" ;
1863
1866
} else if ( desc . enumerable === false ) {
1864
- const tmp = StringPrototypeReplace ( key ,
1865
- strEscapeSequencesReplacer , escapeFn ) ;
1867
+ const tmp = RegExpPrototypeSymbolReplace (
1868
+ strEscapeSequencesReplacer ,
1869
+ key ,
1870
+ escapeFn
1871
+ ) ;
1866
1872
name = `[${ tmp } ]` ;
1867
1873
} else if ( RegExpPrototypeTest ( keyStrRegExp , key ) ) {
1868
1874
name = ctx . stylize ( key , 'name' ) ;
0 commit comments