From 7bafacd236fefbc39d59df2677ecc692dea92148 Mon Sep 17 00:00:00 2001 From: Shrey Banga Date: Thu, 5 May 2016 13:44:59 -0700 Subject: [PATCH] Respect quote style in object literals The option added in fbbaa42ee55a7f753f7cab9b1a905ccf73cf26d5 wasn't being respected inside object literals, so quoted property names would still be stripped out with this option. This is mostly a corner-case, but useful when the output is passed to something like the Closure compiler, where quoted property names can be used to prevent mangling. --- lib/output.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/output.js b/lib/output.js index f8787582..431e6a01 100644 --- a/lib/output.js +++ b/lib/output.js @@ -1142,7 +1142,11 @@ function OutputStream(options) { && parseFloat(key) >= 0) { output.print(make_num(key)); } else if (RESERVED_WORDS(key) ? output.option("screw_ie8") : is_identifier_string(key)) { - output.print_name(key); + if (quote && output.option("quote_style")) { + output.print_string(key, quote); + } else { + output.print_name(key); + } } else { output.print_string(key, quote); }