Underscore-contrib style library but for handlebars. Provide some common handlebars helper functions for use in templates. They are split out by feature area.


  • String helpers
  • Math helpers

Build Status

Build Status


Underscore contrib style handlebars helper functions. Adds helper functions to your handlebars templates as well as in your javascript.


This is an open source project hosted on github. The source is available here.

String Helpers


Capitalize the first character of the first word in the string.

var strings = require("handlebars.strings");

strings.capitalize("this is a sentence.");
// This is a sentence.
{{capitalize this.firstName}}

Capitalize All

var strings = require("handlebars.strings");

strings.capitalize_all("john smith");
// John Smith
{{capitalize-all this.name}}

Normalize Spaces

var strings = require("handlebars.strings");

strings.normalize_spaces("This   is a    sentence.");
// This is a sentence.
{{normalize-spaces this.summary}}

To URL Slug

var strings = require("handlebars.strings");

strings.to_url_slug("Blog Post title!");
// blog-post-title
<a href="localhost/blog/{{to-url-slug this.postTitle}}">post</a>


This helper is a conditional and fully supports the else clause.

<!-- commonNameRegex = /^John/, for example -->
{{#match this.name this.commonNameRegex}}
    <p>What a common name!</p>
    <p>What a unique name!</p>

Math Helpers

While you can use these in javascript, they are really designed for use within the templates. The calculate method in javascript would be easier to do it directly.


The supported operators are [+, -, /, *, %]

{{calculate this.costOfCookies '+' this.costOfMilk}}

{{calculate this.totalPrice '*' this.taxRate}}


This helper is a conditional and fully supports the else clause. The supported operators are [<, <=, >, >=, ==, !=, ===, !==].

{{#compare this.price '<=' this.budget}}
    <p>Too expensive :(</p>