Comparing version 2.1.15 to 2.1.16
{ | ||
"name": "classix", | ||
"version": "2.1.15", | ||
"version": "2.1.16", | ||
"description": "The fastest and tiniest utility for conditionally joining classNames.", | ||
@@ -5,0 +5,0 @@ "main": "dist/cjs/classix.js", |
@@ -9,3 +9,3 @@ ![Banner](media/banner.jpg) | ||
The [fastest](#comparison) and [tiniest](#comparison) utility for conditionally joining classNames. | ||
The [fastest](#performance) and [tiniest](#size) utility for conditionally joining classNames. | ||
@@ -56,5 +56,5 @@ ## Installation | ||
## Why? | ||
## Comparison | ||
classix considers string expressions faster to type and easier to reason about (conditions first, followed by classNames) than the alternative: | ||
Compared to other libraries, classix only allows string expressions as arguments: | ||
@@ -73,6 +73,16 @@ ```js | ||
This reasoning enables classix to simplify its API by allowing only string expressions as arguments. Not only does it provide a consistent way of joining classNames, but using classix also leads to [better performance](#comparison) and a [smaller bundle size](#comparison) for your application. | ||
String expressions have a few benefits over objects: | ||
## Comparison | ||
- A faster typing experience | ||
- A more intuitive syntax (conditions first) | ||
- `else` support through ternary operators | ||
What's more, by leveraging them, classix provides: | ||
- A simpler and consistent API | ||
- [A smaller library size](#size) | ||
- [Better performance](#performance) | ||
### Size | ||
![Size comparison chart](media/size.png) | ||
@@ -82,2 +92,4 @@ | ||
### Performance | ||
![Performance comparison chart](media/perf.png) | ||
@@ -109,4 +121,4 @@ | ||
```diff | ||
- classnames({ 'class-1': cond }); | ||
+ cx(cond && 'class-1') | ||
- classnames({ 'class-1': cond1, 'class-2': cond2 }); | ||
+ cx(cond1 && 'class-1', cond2 && 'class-2') | ||
``` | ||
@@ -113,0 +125,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
6570
130