Socket
Socket
Sign inDemoInstall

babel-plugin-minify-guarded-expressions

Package Overview
Dependencies
1
Maintainers
5
Versions
82
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.4.1 to 0.4.2

15

lib/index.js
"use strict";
const evaluate = require("babel-helper-evaluate-path");
function evaluateTruthy(path) {
const res = evaluate(path);
if (res.confident) return !!res.value;
}
module.exports = function ({

@@ -30,3 +37,3 @@ types: t

if (node.operator === "&&") {
const leftTruthy = left.evaluateTruthy();
const leftTruthy = evaluateTruthy(left);

@@ -38,7 +45,7 @@ if (leftTruthy === false) {

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

@@ -50,3 +57,3 @@ if (leftTruthy === false && left.isPure()) {

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

@@ -53,0 +60,0 @@ }

{
"name": "babel-plugin-minify-guarded-expressions",
"version": "0.4.1",
"version": "0.4.2",
"description": "",

@@ -15,4 +15,4 @@ "keywords": [

"dependencies": {
"babel-helper-flip-expressions": "^0.4.1"
"babel-helper-flip-expressions": "^0.4.2"
}
}

@@ -22,3 +22,3 @@ # babel-plugin-minify-guarded-expressions

```sh
npm install babel-plugin-minify-guarded-expressions
npm install babel-plugin-minify-guarded-expressions --save-dev
```

@@ -25,0 +25,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc