Socket
Socket
Sign inDemoInstall

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.3.20 to 6.3.21

8

lib/generators/statements.js

@@ -47,3 +47,3 @@ "use strict";

var needsBlock = node.alternate && t.isIfStatement(node.consequent);
var needsBlock = node.alternate && t.isIfStatement(getLastStatement(node.consequent));
if (needsBlock) {

@@ -70,2 +70,8 @@ this.push("{");

// Recursively get the last statement.
function getLastStatement(statement) {
if (!t.isStatement(statement.body)) return statement;
return getLastStatement(statement.body);
}
function ForStatement(node /*: Object*/) {

@@ -72,0 +78,0 @@ this.keyword("for");

25

lib/node/index.js

@@ -0,1 +1,3 @@

/* @noflow */
"use strict";

@@ -25,6 +27,2 @@

var _lodashCollectionSome = require("lodash/collection/some");
var _lodashCollectionSome2 = _interopRequireDefault(_lodashCollectionSome);
var _babelTypes = require("babel-types");

@@ -52,2 +50,14 @@

function isOrHasCallExpression(node) {
if (t.isCallExpression(node)) {
return true;
}
if (t.isMemberExpression(node)) {
return isOrHasCallExpression(node.object) || !node.computed && isOrHasCallExpression(node.property);
} else {
return false;
}
}
var Node = (function () {

@@ -99,8 +109,3 @@ function Node(node /*: Object*/, parent /*: Object*/) {

if (t.isNewExpression(parent) && parent.callee === node) {
if (t.isCallExpression(node)) return true;
var hasCall = _lodashCollectionSome2["default"](node, function (val) {
return t.isCallExpression(val);
});
if (hasCall) return true;
if (isOrHasCallExpression(node)) return true;
}

@@ -107,0 +112,0 @@

@@ -200,3 +200,8 @@ /* @flow */

return ArrowFunctionExpression(node, parent);
// export default (function () {});
if (t.isExportDeclaration(parent)) {
return true;
}
return UnaryLike(node, parent);
}

@@ -210,2 +215,6 @@

if (t.isBinaryExpression(parent) || t.isLogicalExpression(parent)) {
return true;
}
return UnaryLike(node, parent);

@@ -212,0 +221,0 @@ }

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

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

"babel-runtime": "^5.0.0",
"babel-types": "^6.3.20",
"babel-types": "^6.3.21",
"detect-indent": "^3.0.1",

@@ -27,4 +27,4 @@ "is-integer": "^1.0.4",

"babel-helper-fixtures": "^6.3.13",
"babylon": "^6.3.20"
"babylon": "^6.3.21"
}
}
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