Remove optional chaining from string-templates
This commit is contained in:
parent
6f67a8f20e
commit
b1f174debe
|
@ -8,7 +8,10 @@ class Helper {
|
||||||
register(handlebars) {
|
register(handlebars) {
|
||||||
// wrap the function so that no helper can cause handlebars to break
|
// wrap the function so that no helper can cause handlebars to break
|
||||||
handlebars.registerHelper(this.name, (value, info) => {
|
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)
|
const result = this.fn(value, context)
|
||||||
if (result == null) {
|
if (result == null) {
|
||||||
return this.useValueFallback ? value : null
|
return this.useValueFallback ? value : null
|
||||||
|
|
Loading…
Reference in New Issue