Socket
Socket
Sign inDemoInstall

@babel/helper-simple-access

Package Overview
Dependencies
17
Maintainers
5
Versions
71
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 7.1.0 to 7.7.0

22

lib/index.js

@@ -8,14 +8,8 @@ "use strict";

function t() {
const data = _interopRequireWildcard(require("@babel/types"));
var t = _interopRequireWildcard(require("@babel/types"));
t = function () {
return data;
};
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
return data;
}
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; if (obj != null) { var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } }
function simplifyAccess(path, bindingNames) {

@@ -47,5 +41,5 @@ path.traverse(simpleAssignmentVisitor, {

const operator = path.node.operator == "++" ? "+=" : "-=";
path.replaceWith(t().assignmentExpression(operator, arg.node, t().numericLiteral(1)));
path.replaceWith(t.assignmentExpression(operator, arg.node, t.numericLiteral(1)));
} else if (path.node.prefix) {
path.replaceWith(t().assignmentExpression("=", t().identifier(localName), t().binaryExpression(path.node.operator[0], t().unaryExpression("+", arg.node), t().numericLiteral(1))));
path.replaceWith(t.assignmentExpression("=", t.identifier(localName), t.binaryExpression(path.node.operator[0], t.unaryExpression("+", arg.node), t.numericLiteral(1))));
} else {

@@ -57,4 +51,4 @@ const old = path.scope.generateUidIdentifierBasedOnNode(arg.node, "old");

});
const binary = t().binaryExpression(path.node.operator[0], t().identifier(varName), t().numericLiteral(1));
path.replaceWith(t().sequenceExpression([t().assignmentExpression("=", t().identifier(varName), t().unaryExpression("+", arg.node)), t().assignmentExpression("=", t().cloneNode(arg.node), binary), t().identifier(varName)]));
const binary = t.binaryExpression(path.node.operator[0], t.identifier(varName), t.numericLiteral(1));
path.replaceWith(t.sequenceExpression([t.assignmentExpression("=", t.identifier(varName), t.unaryExpression("+", arg.node)), t.assignmentExpression("=", t.cloneNode(arg.node), binary), t.identifier(varName)]));
}

@@ -83,3 +77,3 @@ }

path.node.right = t().binaryExpression(path.node.operator.slice(0, -1), t().cloneNode(path.node.left), path.node.right);
path.node.right = t.binaryExpression(path.node.operator.slice(0, -1), t.cloneNode(path.node.left), path.node.right);
path.node.operator = "=";

@@ -86,0 +80,0 @@ }

{
"name": "@babel/helper-simple-access",
"version": "7.1.0",
"version": "7.7.0",
"description": "Babel helper for ensuring that access to a given value is performed through simple accesses",

@@ -14,5 +14,6 @@ "author": "Logan Smyth <loganfsmyth@gmail.com>",

"dependencies": {
"@babel/template": "^7.1.0",
"@babel/types": "^7.0.0"
}
"@babel/template": "^7.7.0",
"@babel/types": "^7.7.0"
},
"gitHead": "97faa83953cb87e332554fa559a4956d202343ea"
}

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc