You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
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

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",