Skip to content

Commit

Permalink
perf(classnames): use arguments instead spread
Browse files Browse the repository at this point in the history
  • Loading branch information
yarastqt committed Aug 14, 2019
1 parent b749948 commit 419604e
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions packages/classnames/classnames.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,14 @@
*
* @param strings classNames strings
*/
export function classnames(...strings: Array<string | undefined>) {
export function classnames(...strings: Array<string | undefined>): string;
export function classnames() {
let className = '';
const uniqueCache = new Set();
const classNameList = strings.join(' ').split(' ');
const classNameList: string[] = [].slice.call(arguments);

for (const value of classNameList) {
if (value === '' || uniqueCache.has(value)) {
if (value === '' || value === undefined || uniqueCache.has(value)) {
continue;
}

Expand Down

0 comments on commit 419604e

Please sign in to comment.