because I got bored of customising my CV for every job
1const PLURAL_SPECIAL_CASES: Record<string, string> = {
2 child: "children",
3 person: "people",
4 mouse: "mice",
5 foot: "feet",
6 tooth: "teeth",
7 goose: "geese",
8 man: "men",
9 woman: "women",
10 ox: "oxen",
11 leaf: "leaves",
12 knife: "knives",
13 life: "lives",
14 elf: "elves",
15 loaf: "loaves",
16 potato: "potatoes",
17 tomato: "tomatoes",
18 cactus: "cacti",
19 focus: "foci",
20 analysis: "analyses",
21 basis: "bases",
22 crisis: "crises",
23 thesis: "theses",
24};
25
26export const pluralize = (word: string, count: number): string => {
27 if (count === 1) {
28 return word;
29 }
30
31 const lowerWord = word.toLowerCase();
32 return PLURAL_SPECIAL_CASES[lowerWord] ?? `${word}s`;
33};