title: In Mustache templating is there an elegant way of expressing a comma separated list without the trailing comma?
body: <p>I am using the <a href="http://mustache.github.com/" rel="noreferrer">Mustache templating library</a> and trying to generate a comma separated list without a trailing comma, e.g.</p>
  
  <blockquote>
    <p>red, green, blue</p>
  </blockquote>
  
  <p>Creating a list with the trailing comma is straightforward, given the structure</p>
  
  <pre><code>{
    "items": [
      {"name": "red"},
      {"name": "green"},
      {"name": "blue"}
    ]
  }
  </code></pre>
  
  <p>and the template</p>
  
  <pre><code>{{#items}}{{name}}, {{/items}}
  </code></pre>
  
  <p>this will resolve to</p>
  
  <blockquote>
    <p>red, green, blue, </p>
  </blockquote>
  
  <p>However I cannot see an elegant way of expressing the case without the trailing comma. I can always generate the list in code before passing it into the template, but I was wondering whether the library offers an alternative approach such as allowing you to to detect whether it is the last item in a list within the template.</p>