You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Support for returning a complex object from a subexpression #264
In handlebars.js one can create a helper that returns a complex object to be used by other helpers like so:
Handlebars.registerHelper("now", () => {
return new Date(); // Returns a complex object, not a string
});
Handlebars.registerHelper("format", (value) => {
if (value instanceof Date) {
// This is the complex Date object, format as date
return Handlebars.SafeString(value.valueOf());
else {
// This is not a Date object
return Handlebars.SafeString("not a date");
}
});
In the template I have something like {{format (now)}}. This works in handlebars.js, but I cannot figure out how to do it in .NET land. I don't want to write (serialize) the object in now() and then deserialize it again in format().
This is something that needs to be supported, but the most obvious ways to do it would introduce breaking changes to 1.x, so it's a core part of planning for v2.
Activity
rexm commentedon Aug 30, 2018
This isn’t natively supported yet. Serialization would work.
rexm commentedon Apr 27, 2019
This is something that needs to be supported, but the most obvious ways to do it would introduce breaking changes to 1.x, so it's a core part of planning for v2.
Extreme refactoring/enhancements