UNPKG

handlebars-helper-pluralize

Version:

A Handlebars helper for conditionally pluralizing words

63 lines (38 loc) 1.07 kB
# handlebars-helper-pluralize A Handlebars helper for conditionally pluralizing words ## Installation Download node at [nodejs.org](http://nodejs.org) and install it, if you haven't already. ```sh npm install handlebars-helper-pluralize --save ``` ## Usage ```js var express = require("express") var hbs = require("hbs") hbs.registerHelper("pluralize", require("handlebars-helper-pluralize")) var app = express() app.set("view engine", "hbs") // etc... ``` Use the helper in your Handlebars template: ```hbs {{#pluralize 2 pony}} ``` The above code will output `ponies`. To include the count in the output, pass `true` as a third argument: ```hbs {{#pluralize 2 pony true}} ``` The above will output `2 ponies`. ## Tests ```sh npm install npm test ``` ## Dependencies - [i](https://github.com/pksunkara/inflect): custom inflections for nodejs ## Dev Dependencies - [tap](https://github.com/isaacs/node-tap): A Test-Anything-Protocol library ## License ISC _Generated by [package-json-to-readme](https://github.com/zeke/package-json-to-readme)_