Socket
Socket
Sign inDemoInstall

babel-generator

Package Overview
Dependencies
Maintainers
3
Versions
94
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

babel-generator - npm Package Compare versions

Comparing version 6.2.0 to 6.2.3

4

lib/buffer.js

@@ -113,3 +113,5 @@ "use strict";

this.newline(true);
//if (this.format.compact) this._removeLast(";");
if (this.format.compact && !this._lastPrintedIsEmptyStatement) {
this._removeLast(";");
}
this.push("}");

@@ -116,0 +118,0 @@ };

@@ -173,2 +173,3 @@ /* @flow */

function EmptyStatement() {
this._lastPrintedIsEmptyStatement = true;
this.semicolon();

@@ -184,3 +185,5 @@ }

this.print(node.left, node);
this.push(" = ");
this.space();
this.push("=");
this.space();
this.print(node.right, node);

@@ -201,3 +204,2 @@ }

var spaces = !this.format.compact || node.operator === "in" || node.operator === "instanceof";
spaces = true; // todo: https://github.com/babel/babel/issues/1835
if (spaces) this.push(" ");

@@ -210,3 +212,5 @@

// http://javascript.spec.whatwg.org/#comment-syntax
spaces = node.operator === "<" && t.isUnaryExpression(node.right, { prefix: true, operator: "!" }) && t.isUnaryExpression(node.right.argument, { prefix: true, operator: "--" });
spaces = node.operator === "<" && t.isUnaryExpression(node.right, { prefix: true, operator: "!" }) && t.isUnaryExpression(node.right.argument, { prefix: true, operator: "--" }) ||
// Need spaces for operators of the same kind to avoid: `a+++b`
t.isUnaryExpression(node.right, { prefix: true, operator: node.operator }) || t.isUpdateExpression(node.right, { prefix: true, operator: node.operator + node.operator });
}

@@ -213,0 +217,0 @@

@@ -53,2 +53,4 @@ "use strict";

this._lastPrintedIsEmptyStatement = false;
if (parent && parent._compact) {

@@ -192,8 +194,8 @@ node._compact = true;

var node = parent.body;
if (t.isEmptyStatement(node)) {
this.semicolon();
} else {
this.push(" ");
this.print(node, parent);
if (!t.isEmptyStatement(node)) {
this.space();
}
this.print(node, parent);
};

@@ -200,0 +202,0 @@

{
"name": "babel-generator",
"version": "6.2.0",
"version": "6.2.3",
"description": "Turns an AST into code.",

@@ -16,3 +16,3 @@ "author": "Sebastian McKenzie <sebmck@gmail.com>",

"babel-runtime": "^5.0.0",
"babel-types": "^6.2.0",
"babel-types": "^6.2.3",
"detect-indent": "^3.0.1",

@@ -19,0 +19,0 @@ "is-integer": "^1.0.4",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc