File tree Expand file tree Collapse file tree 2 files changed +16
-14
lines changed Expand file tree Collapse file tree 2 files changed +16
-14
lines changed Original file line number Diff line number Diff line change @@ -178,19 +178,21 @@ export default {
178
178
} ,
179
179
180
180
transformSpecialTokens ( str , display ) {
181
- Object . keys ( SPECIAL_TOKENS ) . forEach ( key => {
182
- const value = JSON . stringify ( SPECIAL_TOKENS [ key ] )
183
- let search
184
- let replace
185
- if ( display ) {
186
- search = value
187
- replace = key
188
- } else {
189
- search = key
190
- replace = value
191
- }
192
- str = str . replace ( new RegExp ( search , 'g' ) , replace )
193
- } )
181
+ if ( str ) {
182
+ Object . keys ( SPECIAL_TOKENS ) . forEach ( key => {
183
+ const value = JSON . stringify ( SPECIAL_TOKENS [ key ] )
184
+ let search
185
+ let replace
186
+ if ( display ) {
187
+ search = value
188
+ replace = key
189
+ } else {
190
+ search = key
191
+ replace = value
192
+ }
193
+ str = str . replace ( new RegExp ( search , 'g' ) , replace )
194
+ } )
195
+ }
194
196
return str
195
197
} ,
196
198
Original file line number Diff line number Diff line change @@ -26,7 +26,7 @@ export const classify = cached((str) => {
26
26
27
27
const camelizeRE = / - ( \w ) / g
28
28
export const camelize = cached ( ( str ) => {
29
- return str . replace ( camelizeRE , toUpper )
29
+ return str && str . replace ( camelizeRE , toUpper )
30
30
} )
31
31
32
32
const kebabizeRE = / ( [ a - z 0 - 9 ] ) ( [ A - Z ] ) / g
You can’t perform that action at this time.
0 commit comments