summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/lib
diff options
context:
space:
mode:
authorPaul Slaughter <pslaughter@gitlab.com>2018-08-01 19:43:50 +0000
committerClement Ho <clemmakesapps@gmail.com>2018-08-01 19:43:50 +0000
commitfbfe04401deb7a08da03502282531364aa25d511 (patch)
tree1b8b25c8ca0f7e048aed07de9cdf24a44fc58c36 /app/assets/javascripts/lib
parentc1fc33d590b3f853ec820fa33ebc114b86af692d (diff)
downloadgitlab-ce-fbfe04401deb7a08da03502282531364aa25d511.tar.gz
Add vanilla JS avatar_helper and update existing avatar helpers
Diffstat (limited to 'app/assets/javascripts/lib')
-rw-r--r--app/assets/javascripts/lib/utils/text_utility.js14
1 files changed, 14 insertions, 0 deletions
diff --git a/app/assets/javascripts/lib/utils/text_utility.js b/app/assets/javascripts/lib/utils/text_utility.js
index 5f25c6ce1ae..2be3c97bd95 100644
--- a/app/assets/javascripts/lib/utils/text_utility.js
+++ b/app/assets/javascripts/lib/utils/text_utility.js
@@ -76,6 +76,20 @@ export function capitalizeFirstCharacter(text) {
}
/**
+ * Returns the first character capitalized
+ *
+ * If falsey, returns empty string.
+ *
+ * @param {String} text
+ * @return {String}
+ */
+export function getFirstCharacterCapitalized(text) {
+ return text
+ ? text.charAt(0).toUpperCase()
+ : '';
+}
+
+/**
* Replaces all html tags from a string with the given replacement.
*
* @param {String} string