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 @@ -29,10 +29,17 @@ const arrow = kleur.dim('=>')
2929const escapeStringContents = ( value : string ) =>
3030 value . replace ( '\\' , '\\\\' ) . replace ( '"' , '\\"' )
3131
32- const quoteIfNecessary = ( value : string ) =>
33- ! either . isLeft ( unquotedAtomParser ( value ) )
34- ? value
35- : quote . concat ( escapeStringContents ( value ) ) . concat ( quote )
32+ const quoteIfNecessary = ( value : string ) => {
33+ const unquotedAtomResult = unquotedAtomParser ( value )
34+ if (
35+ either . isLeft ( unquotedAtomResult ) ||
36+ unquotedAtomResult . value . remainingInput . length !== 0
37+ ) {
38+ return quote . concat ( escapeStringContents ( value ) ) . concat ( quote )
39+ } else {
40+ return value
41+ }
42+ }
3643
3744const atom = ( node : string ) : Right < string > =>
3845 either . makeRight (
You can’t perform that action at this time.
0 commit comments