framework/js/lib/utils/class-list.js

13 lines
272 B
JavaScript
Raw Normal View History

2015-04-25 20:58:39 +08:00
export default function classList(classes) {
var classNames = [];
for (var i in classes) {
var value = classes[i];
if (value === true) {
classNames.push(i);
} else if (value) {
classNames.push(value);
}
}
return classNames.join(' ');
}