Remove non-existant template and add new helper
This commit is contained in:
parent
d4c13363d0
commit
72f3ac4eee
1 changed files with 14 additions and 1 deletions
|
|
@ -3,7 +3,6 @@ export const partials = [
|
||||||
`actors/char-sheet-mvp/partials/stat.hbs`,
|
`actors/char-sheet-mvp/partials/stat.hbs`,
|
||||||
`actors/char-sheet-mvp/partials/skill.hbs`,
|
`actors/char-sheet-mvp/partials/skill.hbs`,
|
||||||
`actors/char-sheet-mvp/partials/panel.hbs`,
|
`actors/char-sheet-mvp/partials/panel.hbs`,
|
||||||
`actors/char-sheet-mvp/partials/panels/skills.hbs`,
|
|
||||||
`items/aspect.hbs`,
|
`items/aspect.hbs`,
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
@ -11,6 +10,7 @@ export async function registerHandlebarsHelpers() {
|
||||||
Handlebars.registerHelper({
|
Handlebars.registerHelper({
|
||||||
"dotdungeon-array": createArray,
|
"dotdungeon-array": createArray,
|
||||||
"dotdungeon-toFriendlyDuration": toFriendlyDuration,
|
"dotdungeon-toFriendlyDuration": toFriendlyDuration,
|
||||||
|
"dotdungeon-objectValue": objectValue
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -36,6 +36,19 @@ function createArray(...args) {
|
||||||
return args.slice(0, -1);
|
return args.slice(0, -1);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
function objectValue(obj, keypath) {
|
||||||
|
// console.log(obj, keypath.string)
|
||||||
|
return keypath
|
||||||
|
function helper(o, k) {
|
||||||
|
let v = o[k[0]];
|
||||||
|
if (typeof v === "object") {
|
||||||
|
return helper(v, k.slice(1));
|
||||||
|
};
|
||||||
|
return v;
|
||||||
|
};
|
||||||
|
return helper(obj, keypath.string.split(`.`))
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
const secondsInAMinute = 60;
|
const secondsInAMinute = 60;
|
||||||
const secondsInAnHour = 60 * secondsInAMinute;
|
const secondsInAnHour = 60 * secondsInAMinute;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue