Socket
Socket
Sign inDemoInstall

classix

Package Overview
Dependencies
Maintainers
1
Versions
55
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

classix - npm Package Compare versions

Comparing version 1.2.1 to 1.2.2

2

package.json
{
"name": "classix",
"version": "1.2.1",
"version": "1.2.2",
"description": "The fastest and tiniest utility for conditionally joining classNames.",

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

@@ -51,21 +51,17 @@ # classix

| | classix | clsx | classnames |
| ------------ | ------------------------------------------------ | --------------------------------------------- | --------------------------------------------------- |
| **Size** | [277B](https://bundlephobia.com/package/classix) | [330B](https://bundlephobia.com/package/clsx) | [454B](https://bundlephobia.com/package/classnames) |
| **Ops/s\*** | 29M | 28M | 7M |
| **Strings** | Yes | Yes | Yes |
| **Numbers** | Yes | Yes | Yes |
| **Booleans** | Yes | Yes | Yes |
| **Arrays** | Yes with spreading | Yes | Yes |
| **Objects** | No\*\* | Yes | Yes |
![Size comparison chart](media/size.png)
\*Operations per second on an AMD Ryzen 5 5600x
Sources: [classix](https://bundlephobia.com/package/classix), [clsx](https://bundlephobia.com/package/clsx), [classnames](https://bundlephobia.com/package/classnames)
\*\*classix aims to provide the fastest and tiniest utility by omitting the object API, which it considers less ergonomic than standard function arguments:
![Performance comparison chart](media/perf.png)
Sources: Ran [benchmark](benchmark/) on an AMD Ryzen 5 5600x.
Compared to other librairies, classix simplifies its API by forbidding object arguments, which it considers less ergonomic than string expressions:
```js
// 🚫
cx({ class1: isPrimary && isLarge, class2: !isPrimary || !isLarge });
cx({ "class-1": isPrimary && isLarge, "class-2": !isPrimary || !isLarge });
// ✅
cx(isPrimary && isLarge ? "class1" : "class2");
cx(isPrimary && isLarge ? "class-1" : "class-2");
```

@@ -72,0 +68,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