Skip to content
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

Multiple Instances #25

Open
blakeembrey opened this issue Aug 5, 2015 · 5 comments
Open

Multiple Instances #25

blakeembrey opened this issue Aug 5, 2015 · 5 comments
Assignees

Comments

@blakeembrey
Copy link
Collaborator

It'd be cool to create multiple pluralize instances. The use-case that's been brought up before is acronyms (so perhaps have an option here for output case or a function that handles sanitization manually?). However, I think multiple locales would be perfect too. E.g. require('pluralize/de'). If anyone is willing to try create automated pluralizations for other locales that'd would be very cool.

@dominykas
Copy link

Hi,

any update on this? I'm happy to PR whatever is a preferred approach.

My personal preference would be to either have some sort of a preserveCase option - I think there are valid scenarios where people would want to simply turn off this behavior, because anything that's uppercase is not really a dictionary word (e.g. on the web my preferred method of capitalizing stuff would be text-transform: uppercase, rather than have capitalized text strings somewhere - I'd probably never need it).

@blakeembrey blakeembrey mentioned this issue Aug 15, 2017
Closed
@janwirth
Copy link

1

@jensbodal
Copy link

jensbodal commented Jul 31, 2018

So I assume this is related to my issue with not being able to set the case of the plural form?

E.g. pluralize.plural('ABC') becomes ABCS. I tried adding a rule to make ABC's plural form to be ABCs but it ignores my casing.

pluralize.addIrregularRule('ABC', 'abcs'); and pluralize.addPluralRule('ABC', 'abcs'); both output ABCS

@blakeembrey
Copy link
Collaborator Author

I think it could be once it’s turned into a flag, as you can then you use the function for this. I’ll be sure to keep it in mind when I work on this, likely this upcoming weekend.

@jensbodal
Copy link

Yeah the real issue is everything gets passed into the restoreCase function. I feel that the ability to write case-sensitive rules should be allowed.

maxh added a commit to loop-payments/prisma-lint that referenced this issue Nov 10, 2023
Great tool!

I'm working with a database where the table names are in plural snake
case, but the Prisma model names are in singular pascal case, and I'd
like to add a lint for that.

I've updated the `model-name-mapping-snake-case` rule to accept two new
options: `pluralize`, and `irregularPlurals`. The pluralization is done
by the `pluralize` library that is already being used elsewhere.

The only caveat is that calls to `pluralize.addIrregularRule` affect the
global ruleset, so will apply elsewhere, but unfortunately that appears
to be a limitation of the library
(plurals/pluralize#25,
plurals/pluralize#87).

---------

Co-authored-by: Max Heinritz <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants