Browse Source

fix: parse params with value true/false as bool

Sv443 1 month ago
parent
commit
8da1d18143
1 changed files with 6 additions and 1 deletions
  1. 6 1
      src/parseURL.js

+ 6 - 1
src/parseURL.js

@@ -56,7 +56,12 @@ function parseURL(url)
                 if(qstrEntry.includes("="))
                 {
                     let splitEntry = qstrEntry.split("=");
-                    qstrObj[decodeURIComponent(splitEntry[0])] = decodeURIComponent(splitEntry[1].toLowerCase());
+                    let val = decodeURIComponent(splitEntry[1].toLowerCase());
+
+                    if(["true", "false"].includes(val.toLowerCase()))
+                        val = Boolean(val.toLowerCase());
+
+                    qstrObj[decodeURIComponent(splitEntry[0])] = val;
                 }
                 else
                 {