babel-plugin-transform-remove-console
Advanced tools
Comparing version 6.10.0-alpha.6546ad11 to 6.10.0-alpha.f95869d4
@@ -5,3 +5,2 @@ "use strict"; | ||
var t = _ref.types; | ||
return { | ||
@@ -12,3 +11,2 @@ name: "transform-remove-console", | ||
var callee = path.get("callee"); | ||
if (!callee.isMemberExpression()) return; | ||
@@ -28,2 +26,3 @@ | ||
}, | ||
MemberExpression: { | ||
@@ -39,2 +38,3 @@ exit(path, state) { | ||
} | ||
} | ||
@@ -46,3 +46,5 @@ } | ||
var name = "console"; | ||
return id.isIdentifier({ name }) && !id.scope.getBinding(name) && id.scope.hasGlobal(name); | ||
return id.isIdentifier({ | ||
name | ||
}) && !id.scope.getBinding(name) && id.scope.hasGlobal(name); | ||
} | ||
@@ -52,3 +54,5 @@ | ||
return excludeArray && excludeArray.some(function (name) { | ||
return property.isIdentifier({ name }); | ||
return property.isIdentifier({ | ||
name | ||
}); | ||
}); | ||
@@ -60,8 +64,9 @@ } | ||
var property = memberExpr.get("property"); | ||
if (isExcluded(property, excludeArray)) return false; | ||
if (isGlobalConsoleId(object)) return true; | ||
return isGlobalConsoleId(object.get("object")) && (property.isIdentifier({ name: "call" }) || property.isIdentifier({ name: "apply" })); | ||
return isGlobalConsoleId(object.get("object")) && (property.isIdentifier({ | ||
name: "call" | ||
}) || property.isIdentifier({ | ||
name: "apply" | ||
})); | ||
} | ||
@@ -71,7 +76,7 @@ | ||
var object = memberExpr.get("object"); | ||
if (!object.isMemberExpression()) return false; | ||
if (isExcluded(object.get("property"), excludeArray)) return false; | ||
return isGlobalConsoleId(object.get("object")) && memberExpr.get("property").isIdentifier({ name: "bind" }); | ||
return isGlobalConsoleId(object.get("object")) && memberExpr.get("property").isIdentifier({ | ||
name: "bind" | ||
}); | ||
} | ||
@@ -78,0 +83,0 @@ |
{ | ||
"name": "babel-plugin-transform-remove-console", | ||
"version": "6.10.0-alpha.6546ad11", | ||
"version": "6.10.0-alpha.f95869d4", | ||
"description": "Remove all console.* calls.", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -54,3 +54,3 @@ # babel-plugin-transform-remove-console | ||
```javascript | ||
require("babel-core").transform("code", { | ||
require("@babel/core").transform("code", { | ||
plugins: ["transform-remove-console"] | ||
@@ -57,0 +57,0 @@ }); |
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
3702
72