Skip to content

Commit

Permalink
Use string concatenation to speed up dedupe (#362)
Browse files Browse the repository at this point in the history
  • Loading branch information
jonkoops authored Jan 8, 2024
1 parent 8db15a4 commit 08e91d2
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions dedupe.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,16 @@ export default function classNames () {
const classSet = new StorageObject();
appendArray(classSet, arguments);

const list = [];
let classes = '';

for (const k in classSet) {
if (classSet[k]) {
list.push(k);
for (const key in classSet) {
if (classSet[key]) {
classes && (classes += ' ');
classes += key;
}
}

return list.join(' ');
return classes;
}

function appendValue (classSet, arg) {
Expand Down

0 comments on commit 08e91d2

Please sign in to comment.