[Scripts > Strip] Minify static bools

This commit is contained in:
CanadaHonk 2022-02-08 14:10:25 +00:00 committed by GitHub
parent 47fa7e40f3
commit fd5b7ba4ca
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -22,6 +22,8 @@ const stripCode = (code) => code
.replaceAll('throw ', 'throw#')
.replaceAll('async ', 'async#')
.replaceAll('else ', 'else#')
.replaceAll('false', '!!0')
.replaceAll('true', '!0')
.replace(/((['"`])[\s\S]*?\2)|[ \n]/g, (_, g1) => g1 || '')
.replaceAll('#', ' ')
.replaceAll('? ?', '??');