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
5
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.5.0-alpha.8b905991 to 0.5.0-alpha.91ed3622

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.5.0-alpha.8b905991",
"version": "0.5.0-alpha.91ed3622",
"description": "",

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

"dependencies": {
"babel-helper-flip-expressions": "^0.5.0-alpha.8b905991"
"babel-helper-flip-expressions": "^0.5.0-alpha.91ed3622"
}
}

@@ -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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc