Skip to content

Clarification on functions as context #39

@thegrandpoobah

Description

@thegrandpoobah

According to the spec (from the section YAML, not mentioned in interpolation YAML):

5) Otherwise, the data is the value returned by calling the method with the given name.

So the following invocation:

Mustache.render('{{foo}}', { foo: function() { return null; } });

Would render out as (at least in JavaScript anyways) null the way I am interpreting the spec. But that seems a little on the sub-optimal side. Did I mis-interpret the sepc or is this another one of those language dependent traps?

Thanks for the clarification.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions