* Step 3: Handle various suffixes with measure > 0
(word: string)
| 193 | * Step 3: Handle various suffixes with measure > 0 |
| 194 | */ |
| 195 | function step3(word: string): string { |
| 196 | const suffixes: [string, string][] = [ |
| 197 | ["icate", "ic"], |
| 198 | ["ative", ""], |
| 199 | ["alize", "al"], |
| 200 | ["iciti", "ic"], |
| 201 | ["ical", "ic"], |
| 202 | ["ful", ""], |
| 203 | ["ness", ""], |
| 204 | ]; |
| 205 | |
| 206 | for (const [suffix, replacement] of suffixes) { |
| 207 | if (word.endsWith(suffix)) { |
| 208 | const stem = word.slice(0, -suffix.length); |
| 209 | if (hasMeasureGreaterThan0(stem)) { |
| 210 | return stem + replacement; |
| 211 | } |
| 212 | return word; |
| 213 | } |
| 214 | } |
| 215 | |
| 216 | return word; |
| 217 | } |
| 218 | |
| 219 | /** |
| 220 | * Step 4: Remove suffixes with measure > 1 |
no test coverage detected