* Step 1a: Handle plural forms and -ed/-ing endings
(word: string)
| 75 | * Step 1a: Handle plural forms and -ed/-ing endings |
| 76 | */ |
| 77 | function step1a(word: string): string { |
| 78 | if (word.endsWith("sses")) { |
| 79 | return word.slice(0, -2); |
| 80 | } |
| 81 | if (word.endsWith("ies")) { |
| 82 | return word.slice(0, -2); |
| 83 | } |
| 84 | if (word.endsWith("ss")) { |
| 85 | return word; |
| 86 | } |
| 87 | if (word.endsWith("s")) { |
| 88 | return word.slice(0, -1); |
| 89 | } |
| 90 | return word; |
| 91 | } |
| 92 | |
| 93 | /** |
| 94 | * Step 1b: Handle -eed, -ed, -ing endings |