babel-generator
Advanced tools
Comparing version 6.3.15 to 6.3.16
@@ -252,3 +252,9 @@ /* @flow */ | ||
if (t.isLiteral(node.object) && !t.isTemplateLiteral(node.object)) { | ||
var val = this.getPossibleRaw(node.object) || this._stringLiteral(node.object); | ||
var val = undefined; | ||
if (this.format.compact) { | ||
val = this._stringLiteral(node.object); | ||
} else { | ||
val = this.getPossibleRaw(node.object) || this._stringLiteral(node.object); | ||
} | ||
if (_isInteger2["default"](+val) && !SCIENTIFIC_NOTATION.test(val) && !ZERO_DECIMAL_INTEGER.test(val) && !this.endsWith(".")) { | ||
@@ -255,0 +261,0 @@ this.push("."); |
@@ -148,2 +148,6 @@ /* @flow */ | ||
if (t.isThrowStatement(parent)) { | ||
return false; | ||
} | ||
// Otherwise err on the side of overparenthesization, adding | ||
@@ -150,0 +154,0 @@ // explicit exceptions above if this proves overzealous. |
@@ -137,10 +137,17 @@ "use strict"; | ||
Printer.prototype._print = function _print(node, parent) { | ||
var extra = this.getPossibleRaw(node); | ||
if (extra) { | ||
this.push(""); | ||
this._push(extra); | ||
} else { | ||
var printMethod = this[node.type]; | ||
printMethod.call(this, node, parent); | ||
// In compact mode we need to produce as little bytes as needed | ||
// and need to make sure that string quoting is consistent. | ||
// That means we have to always reprint as opposed to getting | ||
// the raw value. | ||
if (!this.format.compact) { | ||
var extra = this.getPossibleRaw(node); | ||
if (extra) { | ||
this.push(""); | ||
this._push(extra); | ||
return; | ||
} | ||
} | ||
var printMethod = this[node.type]; | ||
printMethod.call(this, node, parent); | ||
}; | ||
@@ -285,3 +292,3 @@ | ||
} else { | ||
if (comment.value.indexOf("@license") >= 0 || comment.value.indexOf("@preserve") >= 0) { | ||
if (!this.format.compact && (comment.value.indexOf("@license") >= 0 || comment.value.indexOf("@preserve") >= 0)) { | ||
return true; | ||
@@ -288,0 +295,0 @@ } else { |
{ | ||
"name": "babel-generator", | ||
"version": "6.3.15", | ||
"version": "6.3.16", | ||
"description": "Turns an AST into code.", | ||
@@ -5,0 +5,0 @@ "author": "Sebastian McKenzie <sebmck@gmail.com>", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
84979
2606