Skip to content

Instantly share code, notes, and snippets.

@visoft
Created December 19, 2014 13:54
Show Gist options
  • Save visoft/2437ff27716637ea1c84 to your computer and use it in GitHub Desktop.
Save visoft/2437ff27716637ea1c84 to your computer and use it in GitHub Desktop.
Formatting numbers with commas using an Ember helper
Ember.Handlebars.helper 'formatCurrency', (value) ->
value = value || 0
Number(value).toFixed(0).replace /(\d)(?=(\d{3})+(?:\.\d+)?$)/g, "$1,"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment