File tree 3 files changed +12
-4
lines changed
3 files changed +12
-4
lines changed Original file line number Diff line number Diff line change @@ -85,7 +85,7 @@ function createStringifier (customOptions) {
85
85
return function stringifyAny ( push , x ) {
86
86
var context = this ;
87
87
var handler = handlerFor ( context . node , options , handlers ) ;
88
- var currentPath = '/' + context . path . join ( '/' ) ;
88
+ var currentPath = '/' + context . path . map ( String ) . join ( '/' ) ;
89
89
var customization = handlers [ currentPath ] ;
90
90
var acc = {
91
91
context : context ,
@@ -1435,7 +1435,11 @@ function decorateObject () {
1435
1435
}
1436
1436
1437
1437
function sanitizeKey ( key ) {
1438
- return / ^ [ A - Z a - z _ ] + $ / . test ( key ) ? key : JSON . stringify ( key ) ;
1438
+ if ( typeof key === 'symbol' ) {
1439
+ return key . toString ( ) ;
1440
+ } else {
1441
+ return / ^ [ A - Z a - z _ ] + $ / . test ( key ) ? key : JSON . stringify ( key ) ;
1442
+ }
1439
1443
}
1440
1444
1441
1445
function afterAllChildren ( context , push , options ) {
Original file line number Diff line number Diff line change @@ -54,7 +54,7 @@ function createStringifier (customOptions) {
54
54
return function stringifyAny ( push , x ) {
55
55
var context = this ;
56
56
var handler = handlerFor ( context . node , options , handlers ) ;
57
- var currentPath = '/' + context . path . join ( '/' ) ;
57
+ var currentPath = '/' + context . path . map ( String ) . join ( '/' ) ;
58
58
var customization = handlers [ currentPath ] ;
59
59
var acc = {
60
60
context : context ,
Original file line number Diff line number Diff line change @@ -260,7 +260,11 @@ function decorateObject () {
260
260
}
261
261
262
262
function sanitizeKey ( key ) {
263
- return / ^ [ A - Z a - z _ ] + $ / . test ( key ) ? key : JSON . stringify ( key ) ;
263
+ if ( typeof key === 'symbol' ) {
264
+ return key . toString ( ) ;
265
+ } else {
266
+ return / ^ [ A - Z a - z _ ] + $ / . test ( key ) ? key : JSON . stringify ( key ) ;
267
+ }
264
268
}
265
269
266
270
function afterAllChildren ( context , push , options ) {
You can’t perform that action at this time.
0 commit comments