Inflection Helpers

inflection

Visit the: code | unit tests

{{inflect}}

Returns either the singular or plural inflection of a word based on the given count.

Params

  • count {Number}
  • singular {String}: The singular form
  • plural {String}: The plural form
  • includeCount {String}
  • returns {String}

Example

{{inflect 0 "string" "strings"}}
    
    {{inflect 1 "string" "strings"}}
    
    {{inflect 1 "string" "strings" true}}
    
    {{inflect 2 "string" "strings"}}
    
    {{inflect 2 "string" "strings" true}}
    
    

{{ordinalize}}

Returns an ordinalized number as a string.

Params

  • val {String}: The value to ordinalize.
  • returns {String}: The ordinalized number

Example

{{ordinalize 1}}
    
    {{ordinalize 21}}
    
    {{ordinalize 29}}
    
    {{ordinalize 22}}