-
-
Notifications
You must be signed in to change notification settings - Fork 176
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Preserve case #184
Comments
Same issue with for example
It fails because it gets "Foobarii" |
Digging in to the code a bit more I've figured out a workaround that works for us. So instead of
I can do
|
This doesn’t sound so much like you want to preserve case as you want this library to actually understand that |
I noticed you had tests for both PascalCase and camelCase, so I thought that was something you wanted to support
Regardless, I found another scenario where my workaround where I only look at the last word doesn't work. That's when the plural should be e.g. UserNewsList. The way it works is I parse a file with singular names. When I find a word I don't know how to pluralize I ask the user. So: I realize that making NewsList the plural of News is even more out of scope for So yeah, I will definitely have to write some more logic that's specific to our use case on top of |
IIRC that was more around keeping the casing and not supporting pluralization, but it's a good flag. I'll probably look at eliminating some of that logic since it causes a lot of confusion for people. |
@blakeembrey Thanks for your input in this thread. I'll close this issue now as what I want to do is out of scope for Thanks for creating and maintaining this library! |
Hi
We use this library to automatically provide plural and singular forms of data model names.
Typical input would be
User
->Users
Posts
->Post
Comment
->Comments
etc
Those all work great
Problem is with multi-word model names where we need to provide our own rules, like
UserNews
. "News" is the same in singular and plural. So in our use case we need to make up a plural form. So we dopluralize.addIrregularRule('UserNews', 'UserNewses')
. However, now when we dopluralize('UserNews')
we get'Usernewses'
. For us it's important to keep the casing of all letters as they are. Our models are case sensitive. So we need the plural in this case to beUserNewses
.I found a related issue at #131 and PR at #136 but nothing has unfortunately come out of them yet.
@blakeembrey I'm happy to work on a PR this weekend if you can provide some guidance on how you want this solved.
The text was updated successfully, but these errors were encountered: