Socket
Socket
Sign inDemoInstall

@babel/plugin-transform-object-rest-spread

Package Overview
Dependencies
Maintainers
4
Versions
25
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@babel/plugin-transform-object-rest-spread - npm Package Compare versions

Comparing version 8.0.0-alpha.7 to 8.0.0-alpha.8

54

lib/index.js

@@ -5,3 +5,2 @@ import { declare } from '@babel/helper-plugin-utils';

import { isRequired } from '@babel/helper-compilation-targets';
import compatData from '@babel/compat-data/corejs2-built-ins';

@@ -42,2 +41,18 @@ const {

var compatData = {
"Object.assign": {
chrome: "49",
opera: "36",
edge: "13",
firefox: "36",
safari: "10",
node: "6",
deno: "1",
ios: "10",
samsung: "5",
opera_mobile: "36",
electron: "0.37"
}
};
const {

@@ -48,5 +63,5 @@ isAssignmentPattern,

var index = declare((api, opts) => {
api.assertVersion("8.0.0-alpha.7");
api.assertVersion("8.0.0-alpha.8");
const targets = api.targets();
const supportsObjectAssign = !isRequired("es6.object.assign", targets, {
const supportsObjectAssign = !isRequired("Object.assign", targets, {
compatData

@@ -111,15 +126,24 @@ });

const keys = [];
let allLiteral = true;
let allPrimitives = true;
let hasTemplateLiteral = false;
for (const prop of props) {
if (types.isIdentifier(prop.key) && !prop.computed) {
keys.push(types.stringLiteral(prop.key.name));
} else if (types.isTemplateLiteral(prop.key)) {
keys.push(types.cloneNode(prop.key));
const {
key
} = prop;
if (types.isIdentifier(key) && !prop.computed) {
keys.push(types.stringLiteral(key.name));
} else if (types.isTemplateLiteral(key)) {
keys.push(types.cloneNode(key));
hasTemplateLiteral = true;
} else if (types.isLiteral(prop.key)) {
keys.push(types.stringLiteral(String(prop.key.value)));
} else if (types.isLiteral(key)) {
keys.push(types.stringLiteral(String(key.value)));
} else {
keys.push(types.cloneNode(prop.key));
allLiteral = false;
keys.push(types.cloneNode(key));
if (types.isMemberExpression(key, {
computed: false
}) && types.isIdentifier(key.object, {
name: "Symbol"
}) || types.isCallExpression(key) && types.matchesPattern(key.callee, "Symbol.for")) ; else {
allPrimitives = false;
}
}

@@ -129,3 +153,3 @@ }

keys,
allLiteral,
allPrimitives,
hasTemplateLiteral

@@ -166,3 +190,3 @@ };

keys,
allLiteral,
allPrimitives,
hasTemplateLiteral

@@ -174,3 +198,3 @@ } = extractNormalizedKeys(path.node);

let keyExpression;
if (!allLiteral) {
if (!allPrimitives) {
keyExpression = types.callExpression(types.memberExpression(types.arrayExpression(keys), types.identifier("map")), [file.addHelper("toPropertyKey")]);

@@ -177,0 +201,0 @@ } else {

{
"name": "@babel/plugin-transform-object-rest-spread",
"version": "8.0.0-alpha.7",
"version": "8.0.0-alpha.8",
"description": "Compile object rest and spread to ES5",

@@ -20,14 +20,13 @@ "repository": {

"dependencies": {
"@babel/compat-data": "^8.0.0-alpha.7",
"@babel/helper-compilation-targets": "^8.0.0-alpha.7",
"@babel/helper-plugin-utils": "^8.0.0-alpha.7",
"@babel/plugin-transform-parameters": "^8.0.0-alpha.7"
"@babel/helper-compilation-targets": "^8.0.0-alpha.8",
"@babel/helper-plugin-utils": "^8.0.0-alpha.8",
"@babel/plugin-transform-parameters": "^8.0.0-alpha.8"
},
"peerDependencies": {
"@babel/core": "^8.0.0-alpha.7"
"@babel/core": "^8.0.0-alpha.8"
},
"devDependencies": {
"@babel/core": "^8.0.0-alpha.7",
"@babel/helper-plugin-test-runner": "^8.0.0-alpha.7",
"@babel/parser": "^8.0.0-alpha.7"
"@babel/core": "^8.0.0-alpha.8",
"@babel/helper-plugin-test-runner": "^8.0.0-alpha.8",
"@babel/parser": "^8.0.0-alpha.8"
},

@@ -34,0 +33,0 @@ "engines": {

Sorry, the diff of this file is not supported yet

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