Socket
Socket
Sign inDemoInstall

@babel/plugin-transform-typeof-symbol

Package Overview
Dependencies
77
Maintainers
4
Versions
74
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 7.0.0-beta.31 to 7.0.0-beta.32

22

lib/index.js

@@ -6,8 +6,9 @@ "use strict";

function _default(_ref) {
var t = _ref.types;
var _core = require("@babel/core");
function _default() {
return {
visitor: {
Scope: function Scope(_ref2) {
var scope = _ref2.scope;
Scope: function Scope(_ref) {
var scope = _ref.scope;

@@ -25,3 +26,3 @@ if (!scope.getBinding("Symbol")) {

if (path.parentPath.isBinaryExpression() && t.EQUALITY_BINARY_OPERATORS.indexOf(parent.operator) >= 0) {
if (path.parentPath.isBinaryExpression() && _core.types.EQUALITY_BINARY_OPERATORS.indexOf(parent.operator) >= 0) {
var opposite = path.getOpposite();

@@ -43,9 +44,12 @@

var call = t.callExpression(helper, [node.argument]);
var call = _core.types.callExpression(helper, [node.argument]);
var arg = path.get("argument");
if (arg.isIdentifier() && !path.scope.hasBinding(arg.node.name)) {
var undefLiteral = t.stringLiteral("undefined");
var unary = t.unaryExpression("typeof", node.argument);
path.replaceWith(t.conditionalExpression(t.binaryExpression("===", unary, undefLiteral), undefLiteral, call));
var undefLiteral = _core.types.stringLiteral("undefined");
var unary = _core.types.unaryExpression("typeof", node.argument);
path.replaceWith(_core.types.conditionalExpression(_core.types.binaryExpression("===", unary, undefLiteral), undefLiteral, call));
} else {

@@ -52,0 +56,0 @@ path.replaceWith(call);

{
"name": "@babel/plugin-transform-typeof-symbol",
"version": "7.0.0-beta.31",
"version": "7.0.0-beta.32",
"description": "This transformer wraps all typeof expressions with a method that replicates native behaviour. (ie. returning “symbol” for symbols)",

@@ -12,8 +12,8 @@ "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-typeof-symbol",

"peerDependencies": {
"@babel/core": "7.0.0-beta.31"
"@babel/core": "7.0.0-beta.32"
},
"devDependencies": {
"@babel/core": "7.0.0-beta.31",
"@babel/helper-plugin-test-runner": "7.0.0-beta.31"
"@babel/core": "7.0.0-beta.32",
"@babel/helper-plugin-test-runner": "7.0.0-beta.32"
}
}
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