Closed tomhuze closed 9 months ago
Closing this as I can see in https://github.com/blakeembrey/change-case/issues/279 that this is the intended behavior. I think as title-case is smart enough to handle edge cases in all-lowercase input like capitalizing the p in "iphone" and leaving the c lowercase in "apple.com" it would reduce user confusion if title-case itself first changed the input to lowercase instead of the user having to know they need to do that to make it function as expected.
I think as title-case is smart enough to handle edge cases in all-lowercase input like capitalizing the p in "iphone"
It's not smart enough to do this, it doesn't have the full dictionary built in. To handle things like iPhone
, it therefore needs to avoid changing the casing. So it only changes lower-cased words. If it lower-cased things for you, the intent is more likely to break. Such as iPhone
or even acronyms like WTF
or LOL
.
Hi @blakeembrey sorry if I don't have the full understanding here but we do have the list of SMALL_WORDS, can we just lowercase them if they match exactly with one of the small words?
It's possible, but someone with a title might actually want something like SOME BIG DEAL
(except upper casing a small word). Nothing at all does lower casing right now, only upper casing, so we could make it a new option if it's something you need.
Thanks @blakeembrey, could you review the PR here https://github.com/blakeembrey/change-case/pull/332? Thank you so much 🙏
If the input string contains incorrectly capitalized words (according to title casing rules), title-case will not make them lowercase. If you enter "I am An able aArdvark In an airy ark", title-case will output: "I Am An Able aArdvark In an Airy Ark". Inputting an all-lowercase version of the same title i.e. "i am an able aardvark in an airy ark" does output the expected casing: "I Am an Able Aardvark in an Airy Ark"
If an annoying user were to enter a title in "alternating case," title-case would leave it unchanted e.g. "TiTlE-cAsE dOeS nOt CoRrEcT aNy WoRdS cOnTaInInG "wRoNgLy" cApItAlIzEd WoRdS. iNtEnDeD bEhAvIoR?" => "TiTlE-cAsE dOeS nOt CoRrEcT aNy WoRdS cOnTaInInG "wRoNgLy" cApItAlIzEd WoRdS. iNtEnDeD bEhAvIoR?"
Is deferring to capitalization in user input over title-casing rules the intended behavior?