mirror of
https://github.com/redphx/better-xcloud.git
synced 2025-06-03 06:07:19 +02:00
build: collapse if/else blocks without curly braces
This commit is contained in:
parent
9609d0ae7b
commit
cc422b31a4
5
build.ts
5
build.ts
@ -66,9 +66,8 @@ const postProcess = (str: string): string => {
|
||||
// Collapse empty brackets
|
||||
str = str.replaceAll(/\{[\s\n]+\}/g, '{}');
|
||||
|
||||
// Collapse single return
|
||||
str = str.replaceAll(/\)\n\s+return/g, ') return');
|
||||
str = str.replaceAll(/else\n\s+return/g, 'else return');
|
||||
// Collapse if/else blocks without curly braces
|
||||
str = str.replaceAll(/((if \(.*?\)|else)\n\s+)/g, '$2 ');
|
||||
|
||||
// Remove blank lines
|
||||
str = str.replaceAll(/\n([\s]*)\n/g, "\n");
|
||||
|
Loading…
x
Reference in New Issue
Block a user