Only reprint in compact mode

This commit is contained in:
Amjad Masad
2015-12-07 10:59:50 -08:00
parent 89e6d5bc7e
commit 4b99d18ea7
4 changed files with 41 additions and 1 deletions

View File

@@ -221,7 +221,13 @@ export function MemberExpression(node: Object) {
this.push("]");
} else {
if (t.isLiteral(node.object) && !t.isTemplateLiteral(node.object)) {
let val = this._stringLiteral(node.object);
let val;
if (this.format.compact) {
val = this._stringLiteral(node.object);
} else {
val = this.getPossibleRaw(node.object) || this._stringLiteral(node.object);
}
if (isInteger(+val) && !SCIENTIFIC_NOTATION.test(val) && !ZERO_DECIMAL_INTEGER.test(val) && !this.endsWith(".")) {
this.push(".");
}