@@ -77,9 +77,7 @@ var Debug;
77
77
78
78
/* eslint-disable */
79
79
const strEscapeSequencesRegExp = / [ \x00 - \x1f \x27 \x5c ] / ;
80
- const keyEscapeSequencesRegExp = / [ \x00 - \x1f \x27 ] / ;
81
80
const strEscapeSequencesReplacer = / [ \x00 - \x1f \x27 \x5c ] / g;
82
- const keyEscapeSequencesReplacer = / [ \x00 - \x1f \x27 ] / g;
83
81
/* eslint-enable */
84
82
const keyStrRegExp = / ^ [ a - z A - Z _ ] [ a - z A - Z _ 0 - 9 ] * $ / ;
85
83
const colorRegExp = / \u001b \[ \d \d ? m / g;
@@ -133,34 +131,6 @@ function strEscape(str) {
133
131
return `'${ result } '` ;
134
132
}
135
133
136
- // Escape control characters and single quotes.
137
- // Note: for performance reasons this is not combined with strEscape
138
- function keyEscape ( str ) {
139
- if ( str . length < 5000 && ! keyEscapeSequencesRegExp . test ( str ) )
140
- return `'${ str } '` ;
141
- if ( str . length > 100 )
142
- return `'${ str . replace ( keyEscapeSequencesReplacer , escapeFn ) } '` ;
143
- var result = '' ;
144
- var last = 0 ;
145
- for ( var i = 0 ; i < str . length ; i ++ ) {
146
- const point = str . charCodeAt ( i ) ;
147
- if ( point === 39 || point < 32 ) {
148
- if ( last === i ) {
149
- result += meta [ point ] ;
150
- } else {
151
- result += `${ str . slice ( last , i ) } ${ meta [ point ] } ` ;
152
- }
153
- last = i + 1 ;
154
- }
155
- }
156
- if ( last === 0 ) {
157
- result = str ;
158
- } else if ( last !== i ) {
159
- result += str . slice ( last ) ;
160
- }
161
- return `'${ result } '` ;
162
- }
163
-
164
134
function tryStringify ( arg ) {
165
135
try {
166
136
return JSON . stringify ( arg ) ;
@@ -851,7 +821,7 @@ function formatProperty(ctx, value, recurseTimes, key, array) {
851
821
} else if ( keyStrRegExp . test ( key ) ) {
852
822
name = ctx . stylize ( key , 'name' ) ;
853
823
} else {
854
- name = ctx . stylize ( keyEscape ( key ) , 'string' ) ;
824
+ name = ctx . stylize ( strEscape ( key ) , 'string' ) ;
855
825
}
856
826
857
827
return `${ name } : ${ str } ` ;
0 commit comments