diff options
author | Filipa Lacerda <filipa@gitlab.com> | 2016-10-22 01:33:41 +0300 |
---|---|---|
committer | Filipa Lacerda <filipa@gitlab.com> | 2016-11-16 14:57:56 +0300 |
commit | d418d4990ee5ee0db3d73b8270e2466d1915ad4f (patch) | |
tree | 3ac5d9e5a7f020c31be74c518e2652e8500a5b0b /app/assets/javascripts/lib/utils/text_utility.js | |
parent | 9d8de1c97f03b5fbeedcd0d867eecdd2eed4e1bc (diff) |
Adds humanize function equivalent to ruby
Diffstat (limited to 'app/assets/javascripts/lib/utils/text_utility.js')
-rw-r--r-- | app/assets/javascripts/lib/utils/text_utility.js | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/app/assets/javascripts/lib/utils/text_utility.js b/app/assets/javascripts/lib/utils/text_utility.js index 98f9815ff05..efa25958b15 100644 --- a/app/assets/javascripts/lib/utils/text_utility.js +++ b/app/assets/javascripts/lib/utils/text_utility.js @@ -112,6 +112,9 @@ gl.text.removeListeners = function(form) { return $('.js-md', form).off(); }; + gl.text.humanize = function(string) { + return string.charAt(0).toUpperCase() + string.replace(/_/g, ' ').slice(1); + } return gl.text.truncate = function(string, maxLength) { return string.substr(0, (maxLength - 3)) + '...'; }; |