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

babel-plugin-transform-es2015-spread

Package Overview
Dependencies
Maintainers
4
Versions
35
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

babel-plugin-transform-es2015-spread - npm Package Compare versions

Comparing version 7.0.0-alpha.15 to 7.0.0-alpha.16

23

lib/index.js

@@ -9,3 +9,5 @@ "use strict";

function getSpreadLiteral(spread, scope, state) {
if (state.opts.loose && !t.isIdentifier(spread.argument, { name: "arguments" })) {
if (state.opts.loose && !t.isIdentifier(spread.argument, {
name: "arguments"
})) {
return spread.argument;

@@ -23,2 +25,3 @@ } else {

}
return false;

@@ -60,3 +63,2 @@ }

push(_props, nodes);
return nodes;

@@ -70,6 +72,4 @@ }

scope = path.scope;
var elements = node.elements;
if (!hasSpread(elements)) return;
var nodes = build(elements, scope, state);

@@ -88,15 +88,10 @@ var first = nodes.shift();

scope = path.scope;
var args = node.arguments;
if (!hasSpread(args)) return;
var calleePath = path.get("callee");
if (calleePath.isSuper()) return;
var contextLiteral = t.identifier("undefined");
node.arguments = [];
var nodes = void 0;
var nodes = void 0;
if (args.length === 1 && args[0].argument.name === "arguments") {

@@ -109,2 +104,3 @@ nodes = [args[0].argument];

var first = nodes.shift();
if (nodes.length) {

@@ -120,2 +116,3 @@ node.arguments.push(t.callExpression(t.memberExpression(first, t.identifier("concat")), nodes));

var temp = scope.maybeGenerateMemoised(callee.object);
if (temp) {

@@ -127,2 +124,3 @@ callee.object = t.assignmentExpression("=", temp, callee.object);

}
t.appendToMemberExpression(callee, t.identifier("apply"));

@@ -142,12 +140,7 @@ } else {

scope = path.scope;
var args = node.arguments;
if (!hasSpread(args)) return;
var nodes = build(args, scope, state);
var context = t.arrayExpression([t.nullLiteral()]);
args = t.callExpression(t.memberExpression(context, t.identifier("concat")), nodes);
path.replaceWith(t.newExpression(t.callExpression(t.memberExpression(t.memberExpression(t.memberExpression(t.identifier("Function"), t.identifier("prototype")), t.identifier("bind")), t.identifier("apply")), [node.callee, args]), []));

@@ -154,0 +147,0 @@ }

{
"name": "babel-plugin-transform-es2015-spread",
"version": "7.0.0-alpha.15",
"version": "7.0.0-alpha.16",
"description": "Compile ES2015 spread to ES5",

@@ -12,4 +12,4 @@ "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-es2015-spread",

"devDependencies": {
"babel-helper-plugin-test-runner": "7.0.0-alpha.15"
"babel-helper-plugin-test-runner": "7.0.0-alpha.16"
}
}
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