Socket
Socket
Sign inDemoInstall

babel

Package Overview
Dependencies
Maintainers
1
Versions
165
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

babel - npm Package Compare versions

Comparing version 4.4.4 to 4.4.5

test.js

48

lib/babel/transformation/helpers/name-method.js

@@ -18,45 +18,16 @@ "use strict";

state.selfReference = true;
state.references.push(this);
if (t.isPattern(parent) || t.isAssignmentExpression(parent) || t.isUpdateExpression(parent)) {
state.selfAssignment = true;
}
this.stop();
}
};
var wrapIncludesSelfReference = function (state, method, id, scope) {
var outerId = scope.generateUidIdentifier("getOuter");
var outerIdCall = t.callExpression(outerId, []);
for (var i = 0; i < state.references.length; i++) {
state.references[i].replaceNode(outerIdCall);
}
method.id = id;
return util.template("named-function", {
GET_OUTER_ID: outerId,
FUNCTION_ID: id,
FUNCTION: method
});
};
var wrapIncludesSelfAssignment = function (state, method, id, scope) {
var templateName = "property-method-assignment-wrapper";
if (method.generator) templateName += "-generator";
return util.template(templateName, {
FUNCTION: method,
FUNCTION_ID: id,
FUNCTION_KEY: scope.generateUidIdentifier(id.name),
WRAPPER_KEY: scope.generateUidIdentifier(id.name + "Wrapper")
});
};
var wrap = function (state, method, id, scope) {
if (state.selfReference) {
if (state.selfAssignment) {
return wrapIncludesSelfAssignment(state, method, id, scope);
} else {
return wrapIncludesSelfReference(state, method, id, scope);
}
var templateName = "property-method-assignment-wrapper";
if (method.generator) templateName += "-generator";
return util.template(templateName, {
FUNCTION: method,
FUNCTION_ID: id,
FUNCTION_KEY: scope.generateUidIdentifier(id.name),
WRAPPER_KEY: scope.generateUidIdentifier(id.name + "Wrapper")
});
} else {

@@ -96,3 +67,2 @@ method.id = id;

// with the same id
state.selfAssignment = true;
state.selfReference = true;

@@ -99,0 +69,0 @@ } else {

{
"name": "babel",
"description": "Turn ES6 code into readable vanilla ES5 with source maps",
"version": "4.4.4",
"version": "4.4.5",
"author": "Sebastian McKenzie <sebmck@gmail.com>",

@@ -6,0 +6,0 @@ "homepage": "https://babeljs.io/",

Sorry, the diff of this file is too big to display

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