diff --git a/lib/output.js b/lib/output.js index 42b3aad9..8d3f93be 100644 --- a/lib/output.js +++ b/lib/output.js @@ -60,7 +60,8 @@ function OutputStream(options) { bracketize : false, semicolons : true, comments : false, - preserve_line : false + preserve_line : false, + quote_char : null }, true); var indentation = 0; @@ -95,7 +96,8 @@ function OutputStream(options) { return s; }); if (options.ascii_only) str = to_ascii(str); - if (dq > sq) return "'" + str.replace(/\x27/g, "\\'") + "'"; + var quote_char = options.quote_char || (dq > sq ? "'" : '"'); + if (quote_char === "'") return "'" + str.replace(/\x27/g, "\\'") + "'"; else return '"' + str.replace(/\x22/g, '\\"') + '"'; };