Initial import
This commit is contained in:
19
module/utils.mjs
Normal file
19
module/utils.mjs
Normal file
@@ -0,0 +1,19 @@
|
||||
export default class OathHammerUtils {
|
||||
static registerHandlebarsHelpers() {
|
||||
Handlebars.registerHelper("ifThen", (condition, trueVal, falseVal) => condition ? trueVal : falseVal)
|
||||
Handlebars.registerHelper("capitalize", (str) => {
|
||||
if (typeof str !== "string") return str
|
||||
return str.charAt(0).toUpperCase() + str.slice(1)
|
||||
})
|
||||
Handlebars.registerHelper("concat", (...args) => {
|
||||
args.pop() // remove handlebars options object
|
||||
return args.join("")
|
||||
})
|
||||
}
|
||||
|
||||
static async loadCompendium(packId) {
|
||||
const pack = game.packs.get(packId)
|
||||
if (!pack) return []
|
||||
return await pack.getDocuments()
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user