We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent b749948 commit 0892a84Copy full SHA for 0892a84
packages/classnames/classnames.tsx
@@ -11,13 +11,15 @@
11
*
12
* @param strings classNames strings
13
*/
14
-export function classnames(...strings: Array<string | undefined>) {
+export function classnames(...strings: Array<string | undefined>): string;
15
+export function classnames() {
16
let className = '';
17
const uniqueCache = new Set();
- const classNameList = strings.join(' ').split(' ');
18
+ // Use arguments instead rest operator for better performance.
19
+ const classNameList: Array<string | undefined> = [].slice.call(arguments);
20
21
for (const value of classNameList) {
- if (value === '' || uniqueCache.has(value)) {
22
+ if (value === '' || value === undefined || uniqueCache.has(value)) {
23
continue;
24
}
25
0 commit comments