blakeembrey / change-case

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

Provide a custom array of additions to the lowercase words? #282

Closed Sjoerd82 closed 9 months ago

Sjoerd82 commented 2 years ago

I have a situation where I have to title case for a specific type of work which prefers the lowercasing of "from".

Related: https://github.com/blakeembrey/change-case/issues/265

From what I understood this is not "AP", but acceptable enough. So this lead me to think, wouldn't it be nice to provide a list of "additions " to the lowercase word list as an argument to the titleCase()-function. Assuming that there may be more words that fall into this gray-ish category (an assumption I did not verify, by the way).

I could fairly easily wrap titleCase() in a custom function adding this functionality, but nevertheless, this might be a usefull addition to this pacakge.

blakeembrey commented 9 months ago

I have released support for this is the latest version: https://github.com/blakeembrey/change-case/releases/tag/title-case%404.1.0.

Thanks for the issue! It wasn't as easy as just splitting on whitespace due to all the quirks around punctuation, but I believe I have a reasonable fix to support this and not degrade any of the existing behavior.