Throw some initial version of code at the wall for the tabbed character sheet
This commit is contained in:
parent
eb6d7fee94
commit
b72f22380f
10 changed files with 213 additions and 2 deletions
14
module/handlebarHelpers/toClasses.mjs
Normal file
14
module/handlebarHelpers/toClasses.mjs
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
/**
|
||||
* Allows converting an object of <class names, boolean-likes> into an HTML-compatible class list.
|
||||
*
|
||||
* @param {Record<string, any>} obj The object of class names to boolean-like values for if that class should be included.
|
||||
*/
|
||||
export function toClasses(obj = {}) {
|
||||
let classes = [];
|
||||
for (const [ klass, include ] of Object.entries(obj)) {
|
||||
if (include) {
|
||||
classes.push(klass);
|
||||
};
|
||||
};
|
||||
return new Handlebars.SafeString(classes.join(` `));
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue