@@ -81,9 +81,7 @@ var Debug;
81
81
82
82
/* eslint-disable */
83
83
const strEscapeSequencesRegExp = / [ \x00 - \x1f \x27 \x5c ] / ;
84
- const keyEscapeSequencesRegExp = / [ \x00 - \x1f \x27 ] / ;
85
84
const strEscapeSequencesReplacer = / [ \x00 - \x1f \x27 \x5c ] / g;
86
- const keyEscapeSequencesReplacer = / [ \x00 - \x1f \x27 ] / g;
87
85
/* eslint-enable */
88
86
const keyStrRegExp = / ^ [ a - z A - Z _ ] [ a - z A - Z _ 0 - 9 ] * $ / ;
89
87
const colorRegExp = / \u001b \[ \d \d ? m / g;
@@ -137,34 +135,6 @@ function strEscape(str) {
137
135
return `'${ result } '` ;
138
136
}
139
137
140
- // Escape control characters and single quotes.
141
- // Note: for performance reasons this is not combined with strEscape
142
- function keyEscape ( str ) {
143
- if ( str . length < 5000 && ! keyEscapeSequencesRegExp . test ( str ) )
144
- return `'${ str } '` ;
145
- if ( str . length > 100 )
146
- return `'${ str . replace ( keyEscapeSequencesReplacer , escapeFn ) } '` ;
147
- var result = '' ;
148
- var last = 0 ;
149
- for ( var i = 0 ; i < str . length ; i ++ ) {
150
- const point = str . charCodeAt ( i ) ;
151
- if ( point === 39 || point < 32 ) {
152
- if ( last === i ) {
153
- result += meta [ point ] ;
154
- } else {
155
- result += `${ str . slice ( last , i ) } ${ meta [ point ] } ` ;
156
- }
157
- last = i + 1 ;
158
- }
159
- }
160
- if ( last === 0 ) {
161
- result = str ;
162
- } else if ( last !== i ) {
163
- result += str . slice ( last ) ;
164
- }
165
- return `'${ result } '` ;
166
- }
167
-
168
138
function tryStringify ( arg ) {
169
139
try {
170
140
return JSON . stringify ( arg ) ;
@@ -859,7 +829,7 @@ function formatProperty(ctx, value, recurseTimes, key, array) {
859
829
} else if ( keyStrRegExp . test ( key ) ) {
860
830
name = ctx . stylize ( key , 'name' ) ;
861
831
} else {
862
- name = ctx . stylize ( keyEscape ( key ) , 'string' ) ;
832
+ name = ctx . stylize ( strEscape ( key ) , 'string' ) ;
863
833
}
864
834
865
835
return `${ name } : ${ str } ` ;
0 commit comments