Comparing version 1.2.1 to 1.2.2
{ | ||
"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 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
5139
83