babel-generator
Advanced tools
Comparing version 6.7.2 to 6.7.5
@@ -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>", |
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
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
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
87195
2619
1