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

unreachable-branch-transform

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

unreachable-branch-transform - npm Package Compare versions

Comparing version 0.2.0 to 0.2.1

4

package.json
{
"name": "unreachable-branch-transform",
"version": "0.2.0",
"version": "0.2.1",
"description": "Browserify transform to remove unreachable code",

@@ -32,3 +32,3 @@ "keywords": [

"dependencies": {
"recast": "^0.9.15",
"recast": "^0.10.1",
"through2": "^0.6.2"

@@ -35,0 +35,0 @@ },

@@ -7,12 +7,12 @@ var booleanCondition = require('./lib/evaluator').booleanCondition;

module.exports = removeUnreachable;
var VISITOR_METHODS = {
visitLogicalExpression: visitLogicalExp,
visitIfStatement: visitCondition,
visitConditionalExpression: visitCondition
};
function removeUnreachable(branch) {
recast.visit(branch, {
visitLogicalExpression: visitLogicalExp,
visitIfStatement: visitCondition,
visitConditionalExpression: visitCondition
});
module.exports = function(branch) {
recast.visit(branch, VISITOR_METHODS);
return branch;
}
};

@@ -35,3 +35,3 @@

path.replace(b.literal(true));
removeUnreachable(path);
recast.visit(path, VISITOR_METHODS);
return false;

@@ -43,3 +43,3 @@ }

path.replace(path.node.right);
removeUnreachable(path);
recast.visit(path, VISITOR_METHODS);
return false;

@@ -51,3 +51,3 @@ }

path.replace(b.literal(false));
removeUnreachable(path);
recast.visit(path, VISITOR_METHODS);
return false;

@@ -59,3 +59,3 @@ }

path.replace(path.node.right);
removeUnreachable(path);
recast.visit(path, VISITOR_METHODS);
return false;

@@ -80,3 +80,3 @@ }

path.replace(path.value.consequent);
removeUnreachable(path);
recast.visit(path, VISITOR_METHODS);
return false;

@@ -88,5 +88,5 @@ }

path.replace(path.value.alternate);
removeUnreachable(path);
recast.visit(path, VISITOR_METHODS);
return false;
}
}
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