Socket
Socket
Sign inDemoInstall

@babel/plugin-transform-computed-properties

Package Overview
Dependencies
Maintainers
4
Versions
77
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@babel/plugin-transform-computed-properties - npm Package Compare versions

Comparing version 7.17.12 to 7.18.6

23

lib/index.js

@@ -18,3 +18,4 @@ "use strict";

const pushComputedProps = setComputedProperties ? pushComputedPropsLoose : pushComputedPropsSpec;
const buildMutatorMapAssign = (0, _core.template)(`
const buildMutatorMapAssign = _core.template.statements(`
MUTATOR_MAP_REF[KEY] = MUTATOR_MAP_REF[KEY] || {};

@@ -33,7 +34,3 @@ MUTATOR_MAP_REF[KEY].KIND = VALUE;

function pushAssign(objId, prop, body) {
if (prop.kind === "get" && prop.kind === "set") {
pushMutatorDefine(objId, prop);
} else {
body.push(_core.types.expressionStatement(_core.types.assignmentExpression("=", _core.types.memberExpression(_core.types.cloneNode(objId), prop.key, prop.computed || _core.types.isLiteral(prop.key)), getValue(prop))));
}
body.push(_core.types.expressionStatement(_core.types.assignmentExpression("=", _core.types.memberExpression(_core.types.cloneNode(objId), prop.key, prop.computed || _core.types.isLiteral(prop.key)), getValue(prop))));
}

@@ -64,3 +61,3 @@

for (const prop of info.computedProps) {
if (prop.kind === "get" || prop.kind === "set") {
if (_core.types.isObjectMethod(prop) && (prop.kind === "get" || prop.kind === "set")) {
pushMutatorDefine(info, prop);

@@ -84,9 +81,11 @@ } else {

if (prop.kind === "get" || prop.kind === "set") {
if (_core.types.isObjectMethod(prop) && (prop.kind === "get" || prop.kind === "set")) {
pushMutatorDefine(info, prop);
} else {
const value = getValue(prop);
if (computedProps.length === 1) {
return _core.types.callExpression(state.addHelper("defineProperty"), [info.initPropExpression, key, getValue(prop)]);
return _core.types.callExpression(state.addHelper("defineProperty"), [info.initPropExpression, key, value]);
} else {
body.push(_core.types.expressionStatement(_core.types.callExpression(state.addHelper("defineProperty"), [_core.types.cloneNode(objId), key, getValue(prop)])));
body.push(_core.types.expressionStatement(_core.types.callExpression(state.addHelper("defineProperty"), [_core.types.cloneNode(objId), key, value])));
}

@@ -120,2 +119,6 @@ }

for (const prop of node.properties) {
if (_core.types.isSpreadElement(prop)) {
continue;
}
if (prop.computed) {

@@ -122,0 +125,0 @@ foundComputed = true;

{
"name": "@babel/plugin-transform-computed-properties",
"version": "7.17.12",
"version": "7.18.6",
"description": "Compile ES2015 computed properties to ES5",

@@ -20,3 +20,3 @@ "repository": {

"dependencies": {
"@babel/helper-plugin-utils": "^7.17.12"
"@babel/helper-plugin-utils": "^7.18.6"
},

@@ -27,4 +27,4 @@ "peerDependencies": {

"devDependencies": {
"@babel/core": "^7.17.12",
"@babel/helper-plugin-test-runner": "^7.16.7"
"@babel/core": "^7.18.6",
"@babel/helper-plugin-test-runner": "^7.18.6"
},

@@ -34,3 +34,4 @@ "engines": {

},
"author": "The Babel Team (https://babel.dev/team)"
"author": "The Babel Team (https://babel.dev/team)",
"type": "commonjs"
}
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