diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/data/things/language.js | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/data/things/language.js b/src/data/things/language.js index b0124c10..e3689643 100644 --- a/src/data/things/language.js +++ b/src/data/things/language.js @@ -867,14 +867,14 @@ export class Language extends Thing { typicallyLowerCase(string) { // Utter nonsense implementation, so this only works on strings, - // not actual HTML content, and will loudly disrespect *intentful* + // not actual HTML content, and may rudely disrespect *intentful* // capitalization of whatever goes into it. - if (typeof string === 'string') { - return string[0].toLowerCase() + string.slice(1).toLowerCase(); - } else { - return string; - } + if (typeof string !== 'string') return string; + if (string.length <= 1) return string; + if (/^\S+?[A-Z]/.test(string)) return string; + + return string[0].toLowerCase() + string.slice(1); } // Utility function to quickly provide a useful string key |