[find-and-replace] Fix capitalize utility

This commit is contained in:
Andrew Dupont 2023-12-29 14:32:11 -08:00
parent 39784f11a7
commit 3dc198aca7
2 changed files with 5 additions and 2 deletions

View File

@ -36,7 +36,10 @@ showIf = (condition) ->
else
{display: 'none'}
capitalize = (str) -> str[0].toUpperCase() + str.toLowerCase().slice(1)
capitalize = (str) ->
return '' if str == ''
str[0].toUpperCase() + str.toLowerCase().slice(1)
titleize = (str) -> str.toLowerCase().replace(/(?:^|\s)\S/g, (capital) -> capital.toUpperCase())
preserveCase = (text, reference) ->

View File

@ -139,7 +139,7 @@
"preserveCaseOnReplace": {
"type": "boolean",
"default": false,
"title": "Preserve case during replace.",
"title": "Preserve Case During Replace",
"description": "Keep the replaced text case during replace: replacing 'user' with 'person' will replace 'User' with 'Person' and 'USER' with 'PERSON'."
}
}