We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 23952fd commit a5e2c8aCopy full SHA for a5e2c8a
src/utils/string.ts
@@ -22,6 +22,11 @@ export function removeNewlines(text: string) {
22
* Puts a comment before each line in a string
23
*/
24
export function putCommentBeforeEachLine(text: string, skipLineOne: boolean = true) {
25
+ // Remove duplicate consequitive new lines.
26
+ while (text.match(/\r?\n\r?\n\r?\n/g)) {
27
+ text = text.replace(/\r?\n\r?\n\r?\n/g, "\n\n");
28
+ }
29
+
30
return text.split(/\r?\n/g).map((line, index) => {
31
if (index === 0 && skipLineOne)
32
return line;
0 commit comments