mirror of
https://github.com/flarum/framework.git
synced 2024-12-01 14:20:47 +08:00
ab6c03c0cc
- Use JSX for templates - Docblock/comment everything - Mostly passes ESLint (still some work to do) - Lots of renaming, refactoring, etc. CSS hasn't been updated yet.
21 lines
447 B
JavaScript
21 lines
447 B
JavaScript
/**
|
|
* The `classList` utility creates a list of class names by joining an object's
|
|
* keys, but only for values which are truthy.
|
|
*
|
|
* @example
|
|
* classList({ foo: true, bar: false, qux: 'qaz' });
|
|
* // "foo qux"
|
|
*
|
|
* @param {Object} classes
|
|
* @return {String}
|
|
*/
|
|
export default function classList(classes) {
|
|
const classNames = [];
|
|
|
|
for (const i in classes) {
|
|
if (classes[i]) classNames.push(i);
|
|
}
|
|
|
|
return classNames.join(' ');
|
|
}
|