@babel/plugin-transform-typeof-symbol
Advanced tools
Comparing version 7.0.0-beta.43 to 7.0.0-beta.44
@@ -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 _core() { | ||
const data = require("@babel/core"); | ||
var data = require("@babel/core"); | ||
_core = function () { | ||
_core = function _core() { | ||
return data; | ||
@@ -30,9 +30,9 @@ }; | ||
var _default = (0, _helperPluginUtils().declare)(api => { | ||
var _default = (0, _helperPluginUtils().declare)(function (api) { | ||
api.assertVersion(7); | ||
return { | ||
visitor: { | ||
Scope({ | ||
scope | ||
}) { | ||
Scope: function Scope(_ref) { | ||
var scope = _ref.scope; | ||
if (!scope.getBinding("Symbol")) { | ||
@@ -44,12 +44,9 @@ return; | ||
}, | ||
UnaryExpression(path) { | ||
const { | ||
node, | ||
parent | ||
} = path; | ||
UnaryExpression: function UnaryExpression(path) { | ||
var node = path.node, | ||
parent = path.parent; | ||
if (node.operator !== "typeof") return; | ||
if (path.parentPath.isBinaryExpression() && _core().types.EQUALITY_BINARY_OPERATORS.indexOf(parent.operator) >= 0) { | ||
const opposite = path.getOpposite(); | ||
var opposite = path.getOpposite(); | ||
@@ -61,4 +58,4 @@ if (opposite.isLiteral() && opposite.node.value !== "symbol" && opposite.node.value !== "object") { | ||
const helper = this.addHelper("typeof"); | ||
const isUnderHelper = path.findParent(path => { | ||
var helper = this.addHelper("typeof"); | ||
var isUnderHelper = path.findParent(function (path) { | ||
return path.isVariableDeclarator() && path.node.id === helper || path.isFunctionDeclaration() && path.node.id && path.node.id.name === helper.name; | ||
@@ -71,8 +68,8 @@ }); | ||
const call = _core().types.callExpression(helper, [node.argument]); | ||
var call = _core().types.callExpression(helper, [node.argument]); | ||
const arg = path.get("argument"); | ||
var arg = path.get("argument"); | ||
if (arg.isIdentifier() && !path.scope.hasBinding(arg.node.name, true)) { | ||
const unary = _core().types.unaryExpression("typeof", _core().types.cloneNode(node.argument)); | ||
var unary = _core().types.unaryExpression("typeof", _core().types.cloneNode(node.argument)); | ||
@@ -84,3 +81,2 @@ path.replaceWith(_core().types.conditionalExpression(_core().types.binaryExpression("===", unary, _core().types.stringLiteral("undefined")), _core().types.stringLiteral("undefined"), call)); | ||
} | ||
} | ||
@@ -87,0 +83,0 @@ }; |
{ | ||
"name": "@babel/plugin-transform-typeof-symbol", | ||
"version": "7.0.0-beta.43", | ||
"version": "7.0.0-beta.44", | ||
"description": "This transformer wraps all typeof expressions with a method that replicates native behaviour. (ie. returning “symbol” for symbols)", | ||
@@ -12,11 +12,11 @@ "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-typeof-symbol", | ||
"dependencies": { | ||
"@babel/helper-plugin-utils": "7.0.0-beta.43" | ||
"@babel/helper-plugin-utils": "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" | ||
} | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
3820
59
+ Added@babel/code-frame@7.0.0-beta.44(transitive)
+ Added@babel/core@7.0.0-beta.44(transitive)
+ Added@babel/generator@7.0.0-beta.44(transitive)
+ Added@babel/helper-function-name@7.0.0-beta.44(transitive)
+ Added@babel/helper-get-function-arity@7.0.0-beta.44(transitive)
+ Added@babel/helper-plugin-utils@7.0.0-beta.44(transitive)
+ Added@babel/helper-split-export-declaration@7.0.0-beta.44(transitive)
+ Added@babel/helpers@7.0.0-beta.44(transitive)
+ Added@babel/highlight@7.0.0-beta.44(transitive)
+ Added@babel/template@7.0.0-beta.44(transitive)
+ Added@babel/traverse@7.0.0-beta.44(transitive)
+ Added@babel/types@7.0.0-beta.44(transitive)
+ Addedbabylon@7.0.0-beta.44(transitive)
- Removed@babel/code-frame@7.0.0-beta.43(transitive)
- Removed@babel/core@7.0.0-beta.43(transitive)
- Removed@babel/generator@7.0.0-beta.43(transitive)
- Removed@babel/helper-function-name@7.0.0-beta.43(transitive)
- Removed@babel/helper-get-function-arity@7.0.0-beta.43(transitive)
- Removed@babel/helper-plugin-utils@7.0.0-beta.43(transitive)
- Removed@babel/helper-split-export-declaration@7.0.0-beta.43(transitive)
- Removed@babel/helpers@7.0.0-beta.43(transitive)
- Removed@babel/highlight@7.0.0-beta.43(transitive)
- Removed@babel/template@7.0.0-beta.43(transitive)
- Removed@babel/traverse@7.0.0-beta.43(transitive)
- Removed@babel/types@7.0.0-beta.43(transitive)
- Removedbabylon@7.0.0-beta.43(transitive)