Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

babel-generator

Package Overview
Dependencies
Maintainers
6
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.7.2 to 6.7.5

44

lib/node/parentheses.js

@@ -67,8 +67,3 @@ "use strict";

function ObjectExpression(node, parent, printStack) {
if (t.isExpressionStatement(parent)) {
// ({ foo: "bar" });
return true;
}
return isFirstInStatement(printStack, true);
return isFirstInStatement(printStack, { considerArrow: true });
}

@@ -173,14 +168,4 @@

function ClassExpression(node, parent) {
// (class {});
if (t.isExpressionStatement(parent)) {
return true;
}
// export default (class () {});
if (t.isExportDeclaration(parent)) {
return true;
}
return false;
function ClassExpression(node, parent, printStack) {
return isFirstInStatement(printStack, { considerDefaultExports: true });
}

@@ -201,13 +186,3 @@

function FunctionExpression(node, parent, printStack) {
// (function () {});
if (t.isExpressionStatement(parent)) {
return true;
}
// export default (function () {});
if (t.isExportDeclaration(parent)) {
return true;
}
return isFirstInStatement(printStack);
return isFirstInStatement(printStack, { considerDefaultExports: true });
}

@@ -259,4 +234,9 @@

function isFirstInStatement(printStack) {
var considerArrow = arguments.length <= 1 || arguments[1] === undefined ? false : arguments[1];
var _ref = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1];
var _ref$considerArrow = _ref.considerArrow;
var considerArrow = _ref$considerArrow === undefined ? false : _ref$considerArrow;
var _ref$considerDefaultExports = _ref.considerDefaultExports;
var considerDefaultExports = _ref$considerDefaultExports === undefined ? false : _ref$considerDefaultExports;
var i = printStack.length - 1;

@@ -271,2 +251,6 @@ var node = printStack[i];

if (considerDefaultExports && t.isExportDefaultDeclaration(parent, { declaration: node })) {
return true;
}
if (considerArrow && t.isArrowFunctionExpression(parent, { body: node })) {

@@ -273,0 +257,0 @@ return true;

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

@@ -5,0 +5,0 @@ "author": "Sebastian McKenzie <sebmck@gmail.com>",

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