* Step 2: Handle various suffixes with measure > 0
(word: string)
| 152 | * Step 2: Handle various suffixes with measure > 0 |
| 153 | */ |
| 154 | function step2(word: string): string { |
| 155 | const suffixes: [string, string][] = [ |
| 156 | ["ational", "ate"], |
| 157 | ["tional", "tion"], |
| 158 | ["enci", "ence"], |
| 159 | ["anci", "ance"], |
| 160 | ["izer", "ize"], |
| 161 | ["abli", "able"], |
| 162 | ["alli", "al"], |
| 163 | ["entli", "ent"], |
| 164 | ["eli", "e"], |
| 165 | ["ousli", "ous"], |
| 166 | ["ization", "ize"], |
| 167 | ["ation", "ate"], |
| 168 | ["ator", "ate"], |
| 169 | ["alism", "al"], |
| 170 | ["iveness", "ive"], |
| 171 | ["fulness", "ful"], |
| 172 | ["ousness", "ous"], |
| 173 | ["aliti", "al"], |
| 174 | ["iviti", "ive"], |
| 175 | ["biliti", "ble"], |
| 176 | ["logi", "log"], |
| 177 | ]; |
| 178 | |
| 179 | for (const [suffix, replacement] of suffixes) { |
| 180 | if (word.endsWith(suffix)) { |
| 181 | const stem = word.slice(0, -suffix.length); |
| 182 | if (hasMeasureGreaterThan0(stem)) { |
| 183 | return stem + replacement; |
| 184 | } |
| 185 | return word; |
| 186 | } |
| 187 | } |
| 188 | |
| 189 | return word; |
| 190 | } |
| 191 | |
| 192 | /** |
| 193 | * Step 3: Handle various suffixes with measure > 0 |
no test coverage detected