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

classnames.macro

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

classnames.macro - npm Package Compare versions

Comparing version 1.0.0 to 1.1.0

9

lib/classnames.macro.js

@@ -88,4 +88,8 @@ "use strict";

if (babel.types.isNullLiteral(node)) {
return babel.types.stringLiteral("");
}
if (babel.types.isMemberExpression(node) || babel.types.isIdentifier(node)) {
return babel.types.binaryExpression("+", babel.types.stringLiteral(" "), node);
return babel.types.binaryExpression("+", babel.types.stringLiteral(" "), babel.types.logicalExpression("||", node, babel.types.stringLiteral("")));
} // TODO: This probably does not belong here

@@ -131,2 +135,3 @@

} = unpackArray(input);
const filteredElements = elements.filter(element => !babel.types.isNullLiteral(element) && !(babel.types.isIdentifier(element) && element.name === 'undefined') && !(babel.types.isBooleanLiteral(element) && element.value === false));
const values = groupBy(node => {

@@ -138,3 +143,3 @@ if (babel.types.isStringLiteral(node)) {

return "dynamic";
}, elements);
}, filteredElements);
return concatNodes([concatStringNodes(values.static), ...(values.dynamic ?? [])]);

@@ -141,0 +146,0 @@ } // Return input data if macro was called correctly

{
"name": "classnames.macro",
"version": "1.0.0",
"version": "1.1.0",
"description": "Babel Macro for conditionally joining CSS class names together",

@@ -84,2 +84,3 @@ "keywords": [

"ava": "^3.15.0",
"c8": "^7.10.0",
"common-tags": "^1.4.0",

@@ -86,0 +87,0 @@ "eslint": "^8.4.1",

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