Repository navigation
Leave an uppercase uncountable last word alone - #547
Merged
NullVoxPopuli merged 1 commit intoNov 26, 2026
Merged
NullVoxPopuli merged 1 commit into
NullVoxPopuli merged 1 commit into
Conversation
NullVoxPopuli
approved these changes
Nov 26, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What is wrong
An uncountable word is left alone when it is the whole string, or the last word in lowercase or CamelCase. But when the last word is in ALL CAPS after a space,
-,_or/, it gets inflected:The cause:
LAST_WORD_DASHED_REGEXonly finds a lowercase last word, andLAST_WORD_CAMELIZED_REGEXonly finds one capital letter plus lowercase. An all-caps last word is found by neither, so the uncountable check never sees it.The fix
Let
LAST_WORD_DASHED_REGEXalso match an all-uppercase last word. The last word is only used for the uncountable check, and that check already lowercases the word. Nothing else changes.The test
Added
an uppercase uncountable last word is left aloneintests/unit/inflector-test.ts. It covers space,-,/and_, for bothpluralizeandsingularize, and checks that a normal all-caps word (my CAR) still gets inflected.I also ran the default rules over about 790k words (the system word list plus capitalized, uppercase and multi-word forms). The only outputs that changed were the 420 strings that end in an all-caps uncountable word.