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

babel-plugin-minify-guarded-expressions

Package Overview
Dependencies
Maintainers
2
Versions
82
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

babel-plugin-minify-guarded-expressions - npm Package Compare versions

Comparing version 0.0.2 to 0.0.3

14

lib/index.js

@@ -22,2 +22,12 @@ "use strict";

var right = path.get("right");
// issues - 171, 174, 176
// we assume that it is returned/assigned/part of a bigger expression
// or utilized somehow
// we check if we shouldBail only when evaluating
// the rightside of the expression;
// if the left side is evaluated to be deterministic,
// we can safely replace the entire expression
var shouldBail = !path.parentPath.isExpressionStatement();
if (node.operator === "&&") {

@@ -30,3 +40,3 @@ var leftTruthy = left.evaluateTruthy();

path.replaceWith(node.right);
} else if (right.evaluateTruthy() === false && right.isPure()) {
} else if (right.evaluateTruthy() === false && right.isPure() && !shouldBail) {
path.replaceWith(node.left);

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

path.replaceWith(node.left);
} else if (right.evaluateTruthy() === false && right.isPure()) {
} else if (right.evaluateTruthy() === false && right.isPure() && !shouldBail) {
path.replaceWith(node.left);

@@ -44,0 +54,0 @@ }

2

package.json
{
"name": "babel-plugin-minify-guarded-expressions",
"version": "0.0.2",
"version": "0.0.3",
"description": "",

@@ -5,0 +5,0 @@ "homepage": "https://github.com/babel/babili#readme",

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