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

How to pass object to function? #808

Open
dehghani-mehdi opened this issue Nov 6, 2022 · 1 comment
Open

How to pass object to function? #808

dehghani-mehdi opened this issue Nov 6, 2022 · 1 comment

Comments

@dehghani-mehdi
Copy link

const data = {
    obj: { name: 'john' },
    func: () => (data, render) => { /* JSON.parse(render(data)) doesn't work here! */ }
}
<script id="template" type="x-tmpl-mustache">
    <div>{{#func}}{{obj}}{{/func}}</small>
</script>
@vladrbyte
Copy link

vladrbyte commented Feb 14, 2023

{ "beatles": [ { "firstName": "John", "lastName": "Lennon" }, { "firstName": "Paul", "lastName": "McCartney" }, { "firstName": "George", "lastName": "Harrison" }, { "firstName": "Ringo", "lastName": "Starr" } ], "name": function () { return this.firstName + " " + this.lastName; } }

{{#beatles}}

  • {{name}}
    {{/beatles}}
  • John Lennon
  • Paul McCartney
  • George Harrison
  • Ringo Starr

taken from readme.md

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

3 participants
@dehghani-mehdi @vladrbyte and others