chg: Compress repeated replaces
parent
1770205ee1
commit
dcac64fb9a
|
@ -226,24 +226,14 @@ const Code = {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create newlines after ;
|
// Create newlines after ;
|
||||||
code = code.replace(/;/g, ";\n");
|
code = code.replace(/;/g, ";\n")
|
||||||
|
.replace(/{/g, "{\n")
|
||||||
// Create newlines after { and around }
|
.replace(/}/g, "\n}\n")
|
||||||
code = code.replace(/{/g, "{\n");
|
.replace(/\r/g, "")
|
||||||
code = code.replace(/}/g, "\n}\n");
|
.replace(/^\s+/g, "")
|
||||||
|
.replace(/\n\s+/g, "\n")
|
||||||
// Remove carriage returns
|
.replace(/\s*$/g, "")
|
||||||
code = code.replace(/\r/g, "");
|
.replace(/\n{/g, "{");
|
||||||
|
|
||||||
// Remove all indentation
|
|
||||||
code = code.replace(/^\s+/g, "");
|
|
||||||
code = code.replace(/\n\s+/g, "\n");
|
|
||||||
|
|
||||||
// Remove trailing spaces
|
|
||||||
code = code.replace(/\s*$/g, "");
|
|
||||||
|
|
||||||
// Remove newlines before {
|
|
||||||
code = code.replace(/\n{/g, "{");
|
|
||||||
|
|
||||||
// Indent
|
// Indent
|
||||||
var i = 0,
|
var i = 0,
|
||||||
|
|
Loading…
Reference in New Issue