Created
December 19, 2014 13:54
-
-
Save visoft/2437ff27716637ea1c84 to your computer and use it in GitHub Desktop.
Formatting numbers with commas using an Ember helper
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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