Socket
Socket
Sign inDemoInstall

@babel/plugin-proposal-function-bind

Package Overview
Dependencies
Maintainers
6
Versions
76
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@babel/plugin-proposal-function-bind - npm Package Compare versions

Comparing version 7.0.0-beta.43 to 7.0.0-beta.44

45

lib/index.js

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

function _helperPluginUtils() {
const data = require("@babel/helper-plugin-utils");
var data = require("@babel/helper-plugin-utils");
_helperPluginUtils = function () {
_helperPluginUtils = function _helperPluginUtils() {
return data;

@@ -20,5 +20,5 @@ };

function _pluginSyntaxFunctionBind() {
const data = _interopRequireDefault(require("@babel/plugin-syntax-function-bind"));
var data = _interopRequireDefault(require("@babel/plugin-syntax-function-bind"));
_pluginSyntaxFunctionBind = function () {
_pluginSyntaxFunctionBind = function _pluginSyntaxFunctionBind() {
return data;

@@ -31,5 +31,5 @@ };

function _core() {
const data = require("@babel/core");
var data = require("@babel/core");
_core = function () {
_core = function _core() {
return data;

@@ -43,7 +43,7 @@ };

var _default = (0, _helperPluginUtils().declare)(api => {
var _default = (0, _helperPluginUtils().declare)(function (api) {
api.assertVersion(7);
function getTempId(scope) {
let id = scope.path.getData("functionBind");
var id = scope.path.getData("functionBind");
if (id) return id;

@@ -55,3 +55,3 @@ id = scope.generateDeclaredUidIdentifier("context");

function getStaticContext(bind, scope) {
const object = bind.object || bind.callee.object;
var object = bind.object || bind.callee.object;
return scope.isStatic(object) && object;

@@ -61,5 +61,5 @@ }

function inferBindContext(bind, scope) {
const staticContext = getStaticContext(bind, scope);
var staticContext = getStaticContext(bind, scope);
if (staticContext) return _core().types.cloneNode(staticContext);
const tempId = getTempId(scope);
var tempId = getTempId(scope);

@@ -78,22 +78,17 @@ if (bind.object) {

visitor: {
CallExpression({
node,
scope
}) {
const bind = node.callee;
CallExpression: function CallExpression(_ref) {
var node = _ref.node,
scope = _ref.scope;
var bind = node.callee;
if (!_core().types.isBindExpression(bind)) return;
const context = inferBindContext(bind, scope);
var context = inferBindContext(bind, scope);
node.callee = _core().types.memberExpression(bind.callee, _core().types.identifier("call"));
node.arguments.unshift(context);
},
BindExpression(path) {
const {
node,
scope
} = path;
const context = inferBindContext(node, scope);
BindExpression: function BindExpression(path) {
var node = path.node,
scope = path.scope;
var context = inferBindContext(node, scope);
path.replaceWith(_core().types.callExpression(_core().types.memberExpression(node.callee, _core().types.identifier("bind")), [context]));
}
}

@@ -100,0 +95,0 @@ };

{
"name": "@babel/plugin-proposal-function-bind",
"version": "7.0.0-beta.43",
"version": "7.0.0-beta.44",
"description": "Compile function bind operator to ES5",

@@ -12,12 +12,12 @@ "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-proposal-function-bind",

"dependencies": {
"@babel/helper-plugin-utils": "7.0.0-beta.43",
"@babel/plugin-syntax-function-bind": "7.0.0-beta.43"
"@babel/helper-plugin-utils": "7.0.0-beta.44",
"@babel/plugin-syntax-function-bind": "7.0.0-beta.44"
},
"peerDependencies": {
"@babel/core": "7.0.0-beta.43"
"@babel/core": "7.0.0-beta.44"
},
"devDependencies": {
"@babel/core": "7.0.0-beta.43",
"@babel/helper-plugin-test-runner": "7.0.0-beta.43"
"@babel/core": "7.0.0-beta.44",
"@babel/helper-plugin-test-runner": "7.0.0-beta.44"
}
}
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