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

babel-plugin-transform-remove-console

Package Overview
Dependencies
Maintainers
5
Versions
89
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

babel-plugin-transform-remove-console - npm Package Compare versions

Comparing version 6.10.0-alpha.15ca1f11 to 6.10.0-alpha.18dcfe13

44

lib/index.js
"use strict";
module.exports = function (_ref) {
var t = _ref.types;
module.exports = function ({
types: t
}) {
return {

@@ -10,4 +10,3 @@ name: "transform-remove-console",

CallExpression(path, state) {
var callee = path.get("callee");
const callee = path.get("callee");
if (!callee.isMemberExpression()) return;

@@ -27,2 +26,3 @@

},
MemberExpression: {

@@ -38,2 +38,3 @@ exit(path, state) {

}
}

@@ -44,30 +45,33 @@ }

function isGlobalConsoleId(id) {
var name = "console";
return id.isIdentifier({ name }) && !id.scope.getBinding(name) && id.scope.hasGlobal(name);
const name = "console";
return id.isIdentifier({
name
}) && !id.scope.getBinding(name) && id.scope.hasGlobal(name);
}
function isExcluded(property, excludeArray) {
return excludeArray && excludeArray.some(function (name) {
return property.isIdentifier({ name });
});
return excludeArray && excludeArray.some(name => property.isIdentifier({
name
}));
}
function isIncludedConsole(memberExpr, excludeArray) {
var object = memberExpr.get("object");
var property = memberExpr.get("property");
const object = memberExpr.get("object");
const 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"
}));
}
function isIncludedConsoleBind(memberExpr, excludeArray) {
var object = memberExpr.get("object");
const 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"
});
}

@@ -74,0 +78,0 @@

{
"name": "babel-plugin-transform-remove-console",
"version": "6.10.0-alpha.15ca1f11",
"version": "6.10.0-alpha.18dcfe13",
"description": "Remove all console.* calls.",

@@ -5,0 +5,0 @@ "keywords": [

@@ -22,3 +22,3 @@ # babel-plugin-transform-remove-console

```sh
npm install babel-plugin-transform-remove-console
npm install babel-plugin-transform-remove-console --save-dev
```

@@ -55,3 +55,3 @@

```javascript
require("babel-core").transform("code", {
require("@babel/core").transform("code", {
plugins: ["transform-remove-console"]

@@ -58,0 +58,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