preserve compatibility of `quote_style` (#4845)
authorAlex Lam S.L <alexlamsl@gmail.com>
Tue, 6 Apr 2021 22:49:12 +0000 (23:49 +0100)
committerGitHub <noreply@github.com>
Tue, 6 Apr 2021 22:49:12 +0000 (06:49 +0800)
lib/output.js

index e8fd1cf..ba6785a 100644 (file)
@@ -171,15 +171,15 @@ function OutputStream(options) {
     }
 
     var quote_string = [
-        function(str, quote, dq, sq) {
-            return dq > sq ? quote_single(str) : quote_double(str);
-        },
+        null,
         quote_single,
         quote_double,
         function(str, quote) {
             return quote == "'" ? quote_single(str) : quote_double(str);
         },
-    ][options.quote_style];
+    ][options.quote_style] || function(str, quote, dq, sq) {
+        return dq > sq ? quote_single(str) : quote_double(str);
+    };
 
     function make_string(str, quote) {
         var dq = 0, sq = 0;