Skip to content

Commit 3efa7b7

Browse files
authored
Faster version
It's a faster version, that I use in my [classies lib](https://github.com/StephanHoyer/classies) that pretty much does the same thing.
1 parent 0b3e060 commit 3efa7b7

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

src/index.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
export default function (obj) {
2-
var k, cls='';
2+
let cls
33
for (k in obj) {
44
if (obj[k]) {
5-
cls && (cls += ' ');
6-
cls += k;
5+
cls = cls == null ? cls : cls + ' ' + k;
76
}
87
}
9-
return cls;
8+
return cls || '';
109
}

0 commit comments

Comments
 (0)