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

babel-helper-call-delegate

Package Overview
Dependencies
Maintainers
6
Versions
47
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

babel-helper-call-delegate - npm Package Compare versions

Comparing version 6.6.5 to 6.8.0

102

lib/index.js

@@ -1,76 +0,76 @@

"use strict";
/*istanbul ignore next*/"use strict";
var _interopRequireDefault = require("babel-runtime/helpers/interop-require-default")["default"];
exports.__esModule = true;
var _interopRequireWildcard = require("babel-runtime/helpers/interop-require-wildcard")["default"];
exports.default = function (path) {
/*istanbul ignore next*/var scope = arguments.length <= 1 || arguments[1] === undefined ? path.scope : arguments[1];
/*istanbul ignore next*/var node = path.node;
exports.__esModule = true;
var container = t.functionExpression(null, [], node.body, node.generator, node.async);
var _babelHelperHoistVariables = require("babel-helper-hoist-variables");
var callee = container;
var args = [];
var _babelHelperHoistVariables2 = _interopRequireDefault(_babelHelperHoistVariables);
// todo: only hoist if necessary
/*istanbul ignore next*/(0, _babelHelperHoistVariables2.default)(path, function (id) /*istanbul ignore next*/{
return scope.push({ id: id });
});
var _babelTypes = require("babel-types");
var state = {
foundThis: false,
foundArguments: false
};
var t = _interopRequireWildcard(_babelTypes);
path.traverse(visitor, state);
var visitor = {
enter: function enter(path, state) {
if (path.isThisExpression()) {
state.foundThis = true;
if (state.foundArguments) {
callee = t.memberExpression(container, t.identifier("apply"));
args = [];
if (state.foundThis) {
args.push(t.thisExpression());
}
if (path.isReferencedIdentifier({ name: "arguments" })) {
state.foundArguments = true;
if (state.foundArguments) {
if (!state.foundThis) args.push(t.nullLiteral());
args.push(t.identifier("arguments"));
}
},
Function: function Function(path) {
path.skip();
}
};
exports["default"] = function (path) {
var scope = arguments.length <= 1 || arguments[1] === undefined ? path.scope : arguments[1];
return (function () {
var node = path.node;
var call = t.callExpression(callee, args);
if (node.generator) call = t.yieldExpression(call, true);
var container = t.functionExpression(null, [], node.body, node.generator, node.async);
return t.returnStatement(call);
};
var callee = container;
var args = [];
var /*istanbul ignore next*/_babelHelperHoistVariables = require("babel-helper-hoist-variables");
// todo: only hoist if necessary
_babelHelperHoistVariables2["default"](path, function (id) {
return scope.push({ id: id });
});
/*istanbul ignore next*/
var _babelHelperHoistVariables2 = _interopRequireDefault(_babelHelperHoistVariables);
var state = {
foundThis: false,
foundArguments: false
};
var /*istanbul ignore next*/_babelTypes = require("babel-types");
path.traverse(visitor, state);
/*istanbul ignore next*/
var t = _interopRequireWildcard(_babelTypes);
if (state.foundArguments) {
callee = t.memberExpression(container, t.identifier("apply"));
args = [];
/*istanbul ignore next*/
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
if (state.foundThis) {
args.push(t.thisExpression());
}
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
if (state.foundArguments) {
if (!state.foundThis) args.push(t.nullLiteral());
args.push(t.identifier("arguments"));
}
var visitor = { /*istanbul ignore next*/
enter: function enter(path, state) {
if (path.isThisExpression()) {
state.foundThis = true;
}
var call = t.callExpression(callee, args);
if (node.generator) call = t.yieldExpression(call, true);
return t.returnStatement(call);
})();
if (path.isReferencedIdentifier({ name: "arguments" })) {
state.foundArguments = true;
}
},
/*istanbul ignore next*/Function: function Function(path) {
path.skip();
}
};
module.exports = exports["default"];
/*istanbul ignore next*/module.exports = exports["default"];
{
"name": "babel-helper-call-delegate",
"version": "6.6.5",
"version": "6.8.0",
"description": "",

@@ -9,7 +9,7 @@ "repository": "https://github.com/babel/babel/tree/master/packages/babel-helper-call-delegate",

"dependencies": {
"babel-traverse": "^6.6.5",
"babel-runtime": "^5.0.0",
"babel-types": "^6.6.5",
"babel-helper-hoist-variables": "^6.6.5"
"babel-traverse": "^6.8.0",
"babel-runtime": "^6.0.0",
"babel-types": "^6.8.0",
"babel-helper-hoist-variables": "^6.8.0"
}
}
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