Skip to content

Instantly share code, notes, and snippets.

@rohozhnikoff
Created September 3, 2014 13:41
Show Gist options
  • Save rohozhnikoff/9c4c1090b2963ee0dc7f to your computer and use it in GitHub Desktop.
Save rohozhnikoff/9c4c1090b2963ee0dc7f to your computer and use it in GitHub Desktop.
simple helper to add 's' if length more then 1
`import Ember from 'ember'`
oneormany = (length, value) ->
return "There are no #{value}s" if length is 0
suffix = if length > 1 then 's' else ''
return "#{length} #{value}#{suffix}"
OneormanyHelper = Ember.Handlebars.helper 'oneormany', oneormany
`export { oneormany }`
`export default OneormanyHelper`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment