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

babel-plugin-conditional-compile

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

babel-plugin-conditional-compile - npm Package Compare versions

Comparing version 0.0.2 to 0.0.3

19

dist/index.js

@@ -40,5 +40,5 @@ 'use strict';

//not a block
path.replaceWith(node || types.emptyStatement());
node ? path.replaceWith(node) : path.remove();
} else if (Object.getOwnPropertyNames(scope.bindings).length != 0) {
path.replaceWith(node || types.emptyStatement());
node ? path.replaceWith(node) : path.remove();
} else {

@@ -50,2 +50,15 @@ //no declaration in scope

}
},
LogicalExpression: {
exit: function exit(path) {
var operator = path.node.operator;
var left = path.get('left');
var right = path.get('right');
var leftVal = left.evaluate();
if (operator == '||' && leftVal.confident) {
path.replaceWith(leftVal.value ? left : right);
} else if (operator == '&&' && leftVal.confident) {
path.replaceWith(leftVal.value ? right : left);
}
}
}

@@ -82,4 +95,4 @@ }

default:
throw Error('not support:' + type);
throw Error('not support:' + type + ' as conditional variable');
}
}

2

package.json
{
"name": "babel-plugin-conditional-compile",
"version": "0.0.2",
"version": "0.0.3",
"description": "babel plugin for conditional compile",

@@ -5,0 +5,0 @@ "main": "dist/index.js",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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