Handlebars:
Template
{{lookupOrDefault this 'firstname' 'Name not found'}}
Preparation-Script
Handlebars.registerHelper('lookupOrDefault', function (object, propertyName, defaultValue, options) {
    var result = options.lookupProperty(object, propertyName)
    if (result != null) {
        return result
    }
    return defaultValue
})
Input
{ firstname: "Yehuda" }
Output
Yehuda
마지막 업데이트: 2024. 6. 5. 오후 11:37:24