File tree Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -80,7 +80,7 @@ string minifyString(string jsonString, bool hasComment = false) @trusted
80
80
{
81
81
in_singleline_comment = true ;
82
82
}
83
- else if (matchFrontHit != " \" " && matchFrontHit.matchFirst(spaceOrBreakRegex).empty( ))
83
+ else if (notSlashAndNoSpaceOrBreak(matchFrontHit ))
84
84
{
85
85
new_str ~= matchFrontHit;
86
86
}
@@ -94,7 +94,7 @@ string minifyString(string jsonString, bool hasComment = false) @trusted
94
94
in_singleline_comment = false ;
95
95
}
96
96
}
97
- if (! hasComment && matchFrontHit != " \" " && matchFrontHit.matchFirst(spaceOrBreakRegex).empty( ))
97
+ if (! hasComment && notSlashAndNoSpaceOrBreak(matchFrontHit ))
98
98
{
99
99
new_str ~= matchFrontHit;
100
100
}
@@ -104,13 +104,18 @@ string minifyString(string jsonString, bool hasComment = false) @trusted
104
104
return new_str.array().join(" " );
105
105
}
106
106
107
- bool hasNoSlashOrEvenNumberOfSlashes (string leftContext) @safe
107
+ private bool hasNoSlashOrEvenNumberOfSlashes (string leftContext) @safe
108
108
{
109
109
auto leftContextMatch = leftContext.matchFirst(repeatingBackSlashRegex);
110
110
// if not matched the hit length will be 0 (== leftContextMatch.empty())
111
111
return leftContextMatch.hit().length % 2 == 0 ;
112
112
}
113
113
114
+ private bool notSlashAndNoSpaceOrBreak (string matchFrontHit)
115
+ {
116
+ return matchFrontHit != " \" " && matchFrontHit.matchFirst(spaceOrBreakRegex).empty();
117
+ }
118
+
114
119
/**
115
120
Minify the given files in place. It minifies the files in parallel.
116
121
You can’t perform that action at this time.
0 commit comments