Comparing version 1.0.4 to 1.0.5
{ | ||
"name": "classix", | ||
"version": "1.0.4", | ||
"version": "1.0.5", | ||
"description": "A tiny utility for conditionally joining classNames.", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
# classix | ||
The [fastest](#comparison) and [tiniest](#comparison) utility for conditionally joining classNames. | ||
## Installation | ||
@@ -11,2 +13,4 @@ | ||
Use any amount of string expressions and classix will join them like so: | ||
```js | ||
@@ -35,3 +39,3 @@ import cx from "classix"; | ||
cx(...['class1', 'class2', 'class3']); | ||
cx(...["class1", "class2", "class3"]); | ||
// => class1 class2 class3 | ||
@@ -47,9 +51,31 @@ | ||
## Comparison | ||
| | classix | clsx | classnames | | ||
| ------------ | ------------------------------------------------ | --------------------------------------------- | --------------------------------------------------- | | ||
| **Size** | [281B](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 | | ||
\*Operations per second on an AMD Ryzen 5 5600x | ||
\*\*classix aims to provide the fastest and tiniest utility by ommiting the object API, which it considers less ergonomic than standard function arguments: | ||
```js | ||
// 🚫 | ||
cx({ class1: isPrimary && isLarge, class2: !isPrimary || !isLarge }); | ||
// ✅ | ||
cx(isPrimary && isLarge ? "class1" : "class2"); | ||
``` | ||
## Highlights | ||
- Fast | ||
- Under 1 kB minified & gzipped | ||
- Typed with TypeScript | ||
- Fastest & tiniest | ||
- Zero dependencies | ||
- Fully typed (with TypeScript) | ||
- Fully tested | ||
- Zero dependencies | ||
- Follows [semantic versioning](https://semver.org/) | ||
@@ -56,0 +82,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
6409
87