1
0
Fork 0
mirror of synced 2024-06-14 16:35:02 +12:00

Remove optional chaining from string-templates

This commit is contained in:
Andrew Kingston 2021-10-14 13:04:57 +01:00
parent 2aaad350b4
commit 0539f1a429

View file

@ -8,7 +8,10 @@ class Helper {
register(handlebars) {
// wrap the function so that no helper can cause handlebars to break
handlebars.registerHelper(this.name, (value, info) => {
const context = info?.data?.root || {}
let context = {}
if (info && info.data && info.data.root) {
context = info.data.root
}
const result = this.fn(value, context)
if (result == null) {
return this.useValueFallback ? value : null