File tree Expand file tree Collapse file tree 1 file changed +11
-4
lines changed Expand file tree Collapse file tree 1 file changed +11
-4
lines changed Original file line number Diff line number Diff line change @@ -30,10 +30,17 @@ const arrow = kleur.dim('=>')
3030const escapeStringContents = ( value : string ) =>
3131 value . replace ( '\\' , '\\\\' ) . replace ( '"' , '\\"' )
3232
33- const quoteIfNecessary = ( value : string ) =>
34- ! either . isLeft ( unquotedAtomParser ( value ) )
35- ? value
36- : quote . concat ( escapeStringContents ( value ) ) . concat ( quote )
33+ const quoteIfNecessary = ( value : string ) => {
34+ const unquotedAtomResult = unquotedAtomParser ( value )
35+ if (
36+ either . isLeft ( unquotedAtomResult ) ||
37+ unquotedAtomResult . value . remainingInput . length !== 0
38+ ) {
39+ return quote . concat ( escapeStringContents ( value ) ) . concat ( quote )
40+ } else {
41+ return value
42+ }
43+ }
3744
3845const atom = ( node : string ) : Right < string > =>
3946 either . makeRight (
You can’t perform that action at this time.
0 commit comments