I am using the Mustache templating library and trying to generate a comma separated list without a trailing comma, e.g.
red, green, blue
There is not a built-in way to do this in Mustache. You have to alter your model to support it.
One way to implement this in the template is to use the inverted selection hat {{^last}} {{/last}} tag. It will only omit text for the last item in the list.
{{#items}}
{{name}}{{^last}}, {{/last}}
{{/items}}
Or you can add a delimiter string as ", " to the object, or ideally the base class if you're using a language that has inheritance, then set "delimiter" to an empty string " " for the last element like this:
{{#items}}
{{name}}{{delimiter}}
{{/items}}