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

@babel/helper-explode-assignable-expression

Package Overview
Dependencies
Maintainers
6
Versions
56
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@babel/helper-explode-assignable-expression - npm Package Compare versions

Comparing version 7.14.5 to 7.15.4

43

lib/index.js

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

var t = require("@babel/types");
var _t = require("@babel/types");
const {
assignmentExpression,
cloneNode,
isIdentifier,
isLiteral,
isMemberExpression,
isPrivateName,
isPureish,
isSuper,
memberExpression,
toComputedKey
} = _t;
function getObjRef(node, nodes, scope) {
let ref;
if (t.isIdentifier(node)) {
if (isIdentifier(node)) {
if (scope.hasBinding(node.name)) {

@@ -20,6 +33,6 @@ return node;

}
} else if (t.isMemberExpression(node)) {
} else if (isMemberExpression(node)) {
ref = node.object;
if (t.isSuper(ref) || t.isIdentifier(ref) && scope.hasBinding(ref.name)) {
if (isSuper(ref) || isIdentifier(ref) && scope.hasBinding(ref.name)) {
return ref;

@@ -35,3 +48,3 @@ }

});
nodes.push(t.assignmentExpression("=", t.cloneNode(temp), t.cloneNode(ref)));
nodes.push(assignmentExpression("=", cloneNode(temp), cloneNode(ref)));
return temp;

@@ -43,8 +56,8 @@ }

if (t.isPrivateName(prop)) {
if (isPrivateName(prop)) {
throw new Error("We can't generate property ref for private name, please install `@babel/plugin-proposal-class-properties`");
}
const key = t.toComputedKey(node, prop);
if (t.isLiteral(key) && t.isPureish(key)) return key;
const key = toComputedKey(node, prop);
if (isLiteral(key) && isPureish(key)) return key;
const temp = scope.generateUidIdentifierBasedOnNode(prop);

@@ -54,3 +67,3 @@ scope.push({

});
nodes.push(t.assignmentExpression("=", t.cloneNode(temp), t.cloneNode(prop)));
nodes.push(assignmentExpression("=", cloneNode(temp), cloneNode(prop)));
return temp;

@@ -62,3 +75,3 @@ }

if (t.isIdentifier(node) && allowedSingleIdent) {
if (isIdentifier(node) && allowedSingleIdent) {
obj = node;

@@ -71,10 +84,10 @@ } else {

if (t.isIdentifier(node)) {
ref = t.cloneNode(node);
if (isIdentifier(node)) {
ref = cloneNode(node);
uid = obj;
} else {
const prop = getPropRef(node, nodes, scope);
const computed = node.computed || t.isLiteral(prop);
uid = t.memberExpression(t.cloneNode(obj), t.cloneNode(prop), computed);
ref = t.memberExpression(t.cloneNode(obj), t.cloneNode(prop), computed);
const computed = node.computed || isLiteral(prop);
uid = memberExpression(cloneNode(obj), cloneNode(prop), computed);
ref = memberExpression(cloneNode(obj), cloneNode(prop), computed);
}

@@ -81,0 +94,0 @@

{
"name": "@babel/helper-explode-assignable-expression",
"version": "7.14.5",
"version": "7.15.4",
"description": "Helper function to explode an assignable expression",

@@ -17,6 +17,6 @@ "repository": {

"dependencies": {
"@babel/types": "^7.14.5"
"@babel/types": "^7.15.4"
},
"devDependencies": {
"@babel/traverse": "7.14.5"
"@babel/traverse": "7.15.4"
},

@@ -23,0 +23,0 @@ "engines": {

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