Socket
Socket
Sign inDemoInstall

@babel/helper-wrap-function

Package Overview
Dependencies
4
Maintainers
6
Versions
82
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 7.16.7 to 7.16.8

31

lib/index.js

@@ -60,3 +60,3 @@ "use strict";

function plainFunction(path, callId, noNewArrows) {
function plainFunction(path, callId, noNewArrows, ignoreFunctionLength) {
const node = path.node;

@@ -80,2 +80,12 @@ const isDeclaration = path.isFunctionDeclaration();

const built = callExpression(callId, [node]);
const params = [];
for (const param of node.params) {
if (isAssignmentPattern(param) || isRestElement(param)) {
break;
}
params.push(path.scope.generateUidIdentifier("x"));
}
const container = wrapper({

@@ -85,14 +95,3 @@ NAME: functionId || null,

FUNCTION: built,
PARAMS: node.params.reduce((acc, param) => {
acc.done = acc.done || isAssignmentPattern(param) || isRestElement(param);
if (!acc.done) {
acc.params.push(path.scope.generateUidIdentifier("x"));
}
return acc;
}, {
params: [],
done: false
}).params
PARAMS: params
});

@@ -114,3 +113,3 @@

if (!retFunction || retFunction.id || node.params.length) {
if (!retFunction || retFunction.id || !ignoreFunctionLength && params.length) {
path.replaceWith(container);

@@ -123,8 +122,8 @@ } else {

function wrapFunction(path, callId, noNewArrows = true) {
function wrapFunction(path, callId, noNewArrows = true, ignoreFunctionLength = false) {
if (path.isMethod()) {
classOrObjectMethod(path, callId);
} else {
plainFunction(path, callId, noNewArrows);
plainFunction(path, callId, noNewArrows, ignoreFunctionLength);
}
}
{
"name": "@babel/helper-wrap-function",
"version": "7.16.7",
"version": "7.16.8",
"description": "Helper to wrap functions inside a function call.",

@@ -19,4 +19,4 @@ "repository": {

"@babel/template": "^7.16.7",
"@babel/traverse": "^7.16.7",
"@babel/types": "^7.16.7"
"@babel/traverse": "^7.16.8",
"@babel/types": "^7.16.8"
},

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

SocketSocket SOC 2 Logo

Product

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

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc