Skip to content

Latest commit

 

History

History
21 lines (19 loc) · 558 Bytes

whatdoesitlooklike.md

File metadata and controls

21 lines (19 loc) · 558 Bytes

What it would look like in Kona?

in Javascript, writing a Handlebars helper looks like this:

Handlebars.registerHelper("list", function(items, options) {
  const itemsAsHtml = items.map(item => "<li>" + options.fn(item) + "</li>");
  return "<ul>\n" + itemsAsHtml.join("\n") + "\n</ul>";
});

in Kona it would look like this:

Handlebars.register(:list, (items, options) => {
  <ul>
    {{#each items as item}}
      <li>{{item}}</li>
    {{/each}}
  </ul>
  ul.render { items: items.map( (item) => { options.fn item } ) }
})