Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lambda return values are only compiled with immediate context #219

Open
dpatti opened this issue Apr 9, 2015 · 1 comment
Open

Lambda return values are only compiled with immediate context #219

dpatti opened this issue Apr 9, 2015 · 1 comment
Assignees

Comments

@dpatti
Copy link

dpatti commented Apr 9, 2015

Take this example:

var identity = function(a){ return a; };

var template =
  "{{#one}}" +
    "Two: {{#i}}{{two}}{{/i}}" +
  "{{/one}}";

var context = {
  one: {},
  two: 2,
  i: function(){ 
    return identity;
  }
};

console.log(hogan.compile(template).render(context));

If we run this as above, we get Two:. If we replace the {{#i}}{{two}}{{/i}} section with just {{two}}, we get the expected output of Two: 2. This seems unnatural to me and maybe even under-defined in the mustache spec, but is this the intended behavior?

@sayrer
Copy link
Collaborator

sayrer commented May 1, 2021

I think it probably is, but I'll check this again.

@sayrer sayrer self-assigned this May 1, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants