* Given a word and a count, append an s if count is not one. * @param {string} word A word in its singular form. * @param {number} count A number controlling whether word should be pluralized. * @returns {string} The original word with an s on the end if count is not one.
(word: string, count: number)
| 20 | * @returns {string} The original word with an s on the end if count is not one. |
| 21 | */ |
| 22 | function pluralize(word: string, count: number): string { |
| 23 | return count === 1 ? word : `${word}s`; |
| 24 | } |
| 25 | |
| 26 | //------------------------------------------------------------------------------ |
| 27 | // Public Interface |