Skip to content

Commit 419604e

Browse files
committed
perf(classnames): use arguments instead spread
1 parent b749948 commit 419604e

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

packages/classnames/classnames.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,14 @@
1111
*
1212
* @param strings classNames strings
1313
*/
14-
export function classnames(...strings: Array<string | undefined>) {
14+
export function classnames(...strings: Array<string | undefined>): string;
15+
export function classnames() {
1516
let className = '';
1617
const uniqueCache = new Set();
17-
const classNameList = strings.join(' ').split(' ');
18+
const classNameList: string[] = [].slice.call(arguments);
1819

1920
for (const value of classNameList) {
20-
if (value === '' || uniqueCache.has(value)) {
21+
if (value === '' || value === undefined || uniqueCache.has(value)) {
2122
continue;
2223
}
2324

0 commit comments

Comments
 (0)