File tree Expand file tree Collapse file tree 1 file changed +1
-6
lines changed
mf2/messageformat/src/data-model Expand file tree Collapse file tree 1 file changed +1
-6
lines changed Original file line number Diff line number Diff line change @@ -103,18 +103,13 @@ function stringifyPattern(pattern: Pattern, quoted: boolean) {
103103 quoted = true ;
104104 }
105105 for ( const el of pattern ) {
106- if ( typeof el === 'string' ) res += stringifyString ( el , quoted ) ;
106+ if ( typeof el === 'string' ) res += el . replace ( / [ \\ { } ] / g , '\\$&' ) ;
107107 else if ( el . type === 'markup' ) res += stringifyMarkup ( el ) ;
108108 else res += stringifyExpression ( el ) ;
109109 }
110110 return quoted ? `{{${ res } }}` : res ;
111111}
112112
113- function stringifyString ( str : string , quoted : boolean ) {
114- const esc = quoted ? / [ \\ | ] / g : / [ \\ { } ] / g;
115- return str . replace ( esc , '\\$&' ) ;
116- }
117-
118113function stringifyExpression ( { arg, attributes, functionRef } : Expression ) {
119114 let res : string ;
120115 switch ( arg ?. type ) {
You can’t perform that action at this time.
0 commit comments