blakeembrey / change-case

Convert strings between camelCase, PascalCase, Capital Case, snake_case and more
MIT License
2.27k stars 97 forks source link

`title-case` capitalizes "from" (to "From") #265

Closed jacobjove closed 3 years ago

jacobjove commented 3 years ago

The titleCase function seems to mistakenly capitalize the preposition "from".

Example: before titleCase: "evolution of the earliest amphibians from freshwater fish" after `titleCase: "Evolution of the Earliest Amphibians From Freshwater Fish"

Expected behavior: after `titleCase: "Evolution of the Earliest Amphibians from Freshwater Fish"

blakeembrey commented 3 years ago

Seems subjective, do you have a reference for your expected behavior?

jacobjove commented 3 years ago

You're right. I thought prepositions of 5+ letters are supposed to be capitalized, but now I see that AP and a couple other guides say to capitalize prepositions of 4+ letters.

blakeembrey commented 3 years ago

Yeah, it's all a little subjective. I was looking at this example to double check which uses "From" as the example. I don't use this module personally and just opt for writing in sentence case 🤷