Skip to content

Instantly share code, notes, and snippets.

@etozzato
Created May 16, 2014 21:15
Show Gist options
  • Save etozzato/e782d131ce0d12a50681 to your computer and use it in GitHub Desktop.
Save etozzato/e782d131ce0d12a50681 to your computer and use it in GitHub Desktop.
# A very basic en-us inflector that relies on the UI programmer
# to provide the (optional) plural version of the irregular noun
#
# pluralize 3 'Friend'
# => Friends
# pluralize 0 'Octopus' 'Octopodes'
# => Octopodes
Ember.Handlebars.registerBoundHelper 'pluralize', (count, singular, plural) ->
plural = singular + 's' if typeof(plural) == 'object'
if parseInt(count) == 1 then singular else plural
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment