Pluralize() should in theory pluralize a name while maintaining the cases. For example, FooBar -> FooBars.
However, there are a few cases where the pluralization produces unintentional lowercasing.
-
Half -> halves
It seems that when the whole word matches an item in the singularToPlural map, the entire word gets converted in lowercase. On the contrary, this seems to behave correctly when a singular word is attached to another one, such as the case of LemonHalf -> LemonHalves.
-
SmartPerson -> Smartpeople
It seems that when the suffix matches one of the pluralRules, the entire matched portion remains lowercase.
-
SuperbOx -> Superboxes
It seems that camel-casing is not respected for breaking up words. In fact, the pluralRules seem to be applied first (box -> boxes) before the singularToPlural rules (ox -> oxen). In fact, it seems that when ox is attached to another word, it will never be changed to oxen (example: big_ox -> big_oxes).
Overall, having consistent behavior here is important as this package is used by gobuffalo/pop for auto-generating table names from camel-case structs. Happy to help discuss potential solutions!
Pluralize()should in theory pluralize a name while maintaining the cases. For example,FooBar -> FooBars.However, there are a few cases where the pluralization produces unintentional lowercasing.
Half -> halvesIt seems that when the whole word matches an item in the
singularToPluralmap, the entire word gets converted in lowercase. On the contrary, this seems to behave correctly when a singular word is attached to another one, such as the case ofLemonHalf -> LemonHalves.SmartPerson -> SmartpeopleIt seems that when the suffix matches one of the
pluralRules, the entire matched portion remains lowercase.SuperbOx -> SuperboxesIt seems that camel-casing is not respected for breaking up words.
In fact, theIn fact, it seems that whenpluralRulesseem to be applied first (box -> boxes) before thesingularToPluralrules (ox -> oxen).oxis attached to another word, it will never be changed tooxen(example:big_ox -> big_oxes).Overall, having consistent behavior here is important as this package is used by
gobuffalo/popfor auto-generating table names from camel-case structs. Happy to help discuss potential solutions!