simple-merge-class-names 1.0.6 → 1.0.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -2,6 +2,19 @@
2
2
 
3
3
  A straightforward utility for merging CSS class names in `React + Tailwind` and other JavaScript projects.
4
4
 
5
+ ## Table of Contents
6
+
7
+ - [Installation](#installation)
8
+ - [Install Prettier With VSCode (Most Recommended)](#install-prettier-with-vscode-most-recommended)
9
+ - [Usage](#usage)
10
+ - [Workflow To Minimize Typing Strain](#workflow-to-minimize-typing-strain)
11
+ - [Why the Mismatch Between Exported Function and Package Name?](#why-the-mismatch-between-exported-function-and-package-name)
12
+ - [Where This Package Excels](#where-this-package-excels)
13
+ - [Source Code](#source-code)
14
+ - [Argument Handling](#argument-handling)
15
+ - [Production Considerations](#production-considerations)
16
+ - [License](#license)
17
+
5
18
  ## Installation
6
19
 
7
20
  ```bash
@@ -16,7 +29,7 @@ yarn add simple-merge-class-names
16
29
  npm install simple-merge-class-names
17
30
  ```
18
31
 
19
- ## Install `Prettier` With VSCode (Most Recommended)
32
+ ### Install `Prettier` With VSCode (Most Recommended)
20
33
 
21
34
  [https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode](https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode)
22
35
 
@@ -46,7 +59,7 @@ function MyComponent() {
46
59
  }
47
60
  ```
48
61
 
49
- While using separate strings for each class name can be tedious (see [Workflow To Minimize Typing Strain](#workflow-to-minimize-typing-strain)), it however significantly enhances Code Readability and Developer Experience (DX). This is in contrast to hard-to-read strings like:
62
+ While using separate strings for each class name can be tedious, see [Workflow To Minimize Typing Strain](#workflow-to-minimize-typing-strain), it significantly enhances code readability and Developer Experience (DX). This is in contrast to hard-to-read strings like:
50
63
 
51
64
  ```jsx
52
65
  function MyComponent() {
@@ -58,7 +71,7 @@ function MyComponent() {
58
71
  }
59
72
  ```
60
73
 
61
- ## Workflow To Minimize Typing Strain
74
+ ### Workflow To Minimize Typing Strain
62
75
 
63
76
  ![Screen recording of optimal DX in action: using this package with Prettier as it neatly arranges each class name on a new line](https://raw.githubusercontent.com/new-AF/simple-merge-class-names/main/.github/images/Reduce%20typing%20strain.gif)
64
77
 
@@ -89,27 +102,9 @@ While similar packages exist (`clsx`) with better features and potentially impro
89
102
 
90
103
  ```javascript
91
104
  /**
92
- * mergeClassNames - a utility to merge CSS class names I developed for use in my `React` + `Tailwind` projects. Use it in conjunction with an auto-formatting tool like `Prettier`
93
- *
94
- * Example usage: <div className = {mergeClassNames("flex", "flex-col")}/>
95
- *
96
- * @license AGPL-3.0
97
- * Copyright (C) 2025 Abdullah Fatota
98
- *
99
- * This program is free software: you can redistribute it and/or modify
100
- * it under the terms of the GNU Affero General Public License as published by
101
- * the Free Software Foundation, either version 3 of the License, or
102
- * (at your option) any later version.
103
- *
104
- * This program is distributed in the hope that it will be useful,
105
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
106
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
107
- * GNU Affero General Public License for more details.
108
- *
109
- * You should have received a copy of the GNU Affero General Public License
110
- * along with this program. If not, see <https://www.gnu.org/licenses/>.
105
+ * mergeClassNames - A straightforward utility for merging CSS class names in React + Tailwind, and other JavaScript projects.
106
+ ...
111
107
  */
112
-
113
108
  const isDefined = (val) => val !== undefined && val !== null;
114
109
 
115
110
  const isNotEmptyString = (val) => val !== "";
@@ -124,7 +119,7 @@ export const mergeClassNames = (...args) => {
124
119
  };
125
120
  ```
126
121
 
127
- ## Argument Handling
122
+ ### Argument Handling
128
123
 
129
124
  `mergeClassNames` accepts multiple arguments but filters out `null`, `undefined`, and empty strings (`""`). Remaining values are either strings or are _implicitly converted_ to strings by the JavaScript engine, then joined with spaces to produce the final class name string.
130
125
 
@@ -136,4 +131,4 @@ If you are considering this package for production, you might also want to look
136
131
 
137
132
  This project is licensed under the AGPL-3.0 License. See `LICENSE.txt` for full details.
138
133
 
139
- ## Enjoy 😉
134
+ Enjoy 😉
@@ -1,11 +1,28 @@
1
1
  /**
2
- * mergeClassNames - a utility to merge CSS class names I developed for use in my `React` + `Tailwind` projects. Use it in conjunction with an auto-formatting tool like `Prettier`
3
- *
4
- * Example usage: <div className = {mergeClassNames("flex", "flex-col")}/>
2
+ * mergeClassNames - A straightforward utility for merging CSS class names in React + Tailwind, and other JavaScript projects.
5
3
  *
6
4
  * @license AGPL-3.0
7
5
  * Copyright (C) 2025 Abdullah Fatota
8
6
  *
7
+ * Example usage:
8
+ * import { mergeClassNames } from "simple-merge-class-names";
9
+ *
10
+ * function MyComponent() {
11
+ * return (
12
+ * <div
13
+ * className={mergeClassNames(
14
+ * "app",
15
+ * "min-h-dvh",
16
+ * "grid",
17
+ * "grid-rows-[auto_1fr_auto]",
18
+ * "outline"
19
+ * )}
20
+ * >
21
+ * Hello, world!
22
+ * </div>
23
+ * );
24
+ * }
25
+ *
9
26
  * This program is free software: you can redistribute it and/or modify
10
27
  * it under the terms of the GNU Affero General Public License as published by
11
28
  * the Free Software Foundation, either version 3 of the License, or
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "simple-merge-class-names",
3
- "version": "1.0.6",
3
+ "version": "1.0.8",
4
4
  "description": "Example usage: <div className = {mergeClassNames('flex', 'flex-col')}/>",
5
5
  "main": "mergeClassNames.js",
6
6
  "exports": "./mergeClassNames.js",