Implement lookup helper
This commit is contained in:
@@ -193,6 +193,10 @@ function registerDefaultHelpers(instance) {
|
||||
var level = options.data && options.data.level != null ? parseInt(options.data.level, 10) : 1;
|
||||
instance.log(level, context);
|
||||
});
|
||||
|
||||
instance.registerHelper('lookup', function(obj, field, options) {
|
||||
return obj && obj[field];
|
||||
});
|
||||
}
|
||||
|
||||
export var logger = {
|
||||
|
||||
@@ -85,7 +85,8 @@ Compiler.prototype = {
|
||||
'if': true,
|
||||
'unless': true,
|
||||
'with': true,
|
||||
'log': true
|
||||
'log': true,
|
||||
'lookup': true
|
||||
};
|
||||
if (knownHelpers) {
|
||||
for (var name in knownHelpers) {
|
||||
|
||||
Reference in New Issue
Block a user