At least for me, I was able to use the ".length" function directly like this: (tested with Mustache v 0.8.1)
var tmpl = "{{#repos}}<b>{{name}}</b>{{/repos}} ({{repos.length}})"; var json = { repos: [{ name: "Tom"}, { name: "Dick"}, { name: "Harry"}] }; alert(Mustache.to_html(tmpl, json));
Alerts " <b>Tom</b><b>Dick</b><b>Harry</b> (3) "
source share