fix: pluralize nucleus/nuclei correctly#121
Merged
Merged
Conversation
p-kuen
approved these changes
May 13, 2026
Adds anchored regex rules so:
- pluralize('nucleus') === 'nuclei'
- pluralize('nuclei') === 'nuclei'
- pluralize('nucleuses') === 'nucleuses'
- singularize('nuclei') === 'nucleus'
- singularize('nucleuses') === 'nucleus'
- singularize('nucleus') === 'nucleus'
Patterns are anchored to the `nucle` stem so they cannot
match other -us/-i words.
Fixes dreamerslab#71
05dd49e to
f1ed06f
Compare
Contributor
Author
|
@p-kuen The merge conflict was resolved. |
p-kuen
approved these changes
May 13, 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.
This PR addresses issue #71.
Right now,
pluralize('nucleus')doesn't actually pluralize, and a few related forms come back mangled:After this PR, each of those returns what you'd expect.
pluralize('nucleuses')still gives back'nucleuses'since it's already plural.How
I followed the same shape as the existing
criterion/criteriaandgenus/generarules: three anchored regexes (^(nucle)us$,^(nucle)i$,^(nucle)uses$) added toregex.singularandregex.plural, with matching skip + replace entries inpluralRulesandsingularRules. Because the patterns are anchored to thenuclestem, they can't accidentally catch other-usor-iwords.Test plan
npm testpasses (15 existing tests, plus 6 new assertions covering every case the issue mentioned)