Last Updated: February 25, 2016
·
4.309K
· ultimatedelman

Handlebars Helper for Pluralizing Words

Here's a quick Handlebars.js helper I wrote that will pluralize about 95% of words in the English language. It's not perfect by any means, but if you find edge cases you'd like to include, you can include them in the top.

It depends on jQuery and a library called String.js. Both are completely unnecessary if you want to rewrite the $.inArray() jQuery function or the functionality for .endsWith() and .chompRight() from string.js, but I was already using them in my project so I figured I'd take advantage of it :)

Have a fresh tip? Share with Coderwall community!

Post
Post a tip
Did you know?

JavaScript on a page runs with the privileges of that origin. One altered library, tag manager, or snippet can read inputs, change what people see, and call your APIs as the user.

Security insights from Cside