From c3c6308c3ce31ef9481a6ecd1a2c34011b70d1bd Mon Sep 17 00:00:00 2001
From: overdodactyl <patjohns1216@gmail.com>
Date: Mon, 26 Nov 2018 08:55:52 -0700
Subject: [PATCH] remove comment regex

---
 updater.sh | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/updater.sh b/updater.sh
index 5eca133..1a445b8 100755
--- a/updater.sh
+++ b/updater.sh
@@ -2,7 +2,7 @@
 
 ## ghacks-user.js updater for macOS and Linux
 
-## version: 2.1
+## version: 2.2
 ## Author: Pat Johnson (@overdodactyl)
 ## Additional contributors: @earthlng, @ema-pe
 
@@ -260,7 +260,11 @@ add_override () {
 }
 
 remove_comments () { # expects 2 arguments: from-file and to-file
-  sed -e 's/^[[:space:]]*\/\/.*$//' -e '/^\/\*/,/\*\//d' -e '/^[[:space:]]*$/d' -e 's/);[[:space:]]*\/\/.*/);/' "$1" > "$2"
+  sed -e 's/^[[:space:]]*\/\/.*$//' "$1" | #single line comments
+  sed -e '/^\/\*/,/\*\//d' |               #multi line comments
+  sed -e '/^[[:space:]]*$/d' |             #empty lines
+  sed -e 's/);[[:space:]]*\/\/.*/);/' |    #end of line comments
+  tr  -s '[:space:]' > "$2"                #trime white spaces
 }
 
 # Applies latest version of user.js and any custom overrides