Just pass this object to a JavaScript function, follow the necessary logic, and return it.
<script type= "text/javascript">
Handlebars.registerHelper("ifSet", function (model) {
var count = 0;
while (count < model.length) {
}
return;
});
</script>
<script id="ex" type="text/x-handlebars-template">
{{ifSet model}}
</script>
source
share