diff options
author | Jacob Schatz <jschatz@gitlab.com> | 2017-02-18 21:52:43 +0300 |
---|---|---|
committer | Jacob Schatz <jschatz@gitlab.com> | 2017-02-18 21:52:43 +0300 |
commit | 12cd4c83604e43dc308ba13fa3d5a6571409c1f8 (patch) | |
tree | 3420c6147f01a9b0d66f665bd8d1124c7699b679 /app/assets/javascripts/lib | |
parent | 6eb45df2fd62c85920c3ef025d7dacadcda05bf4 (diff) | |
parent | bf30a78064f9d0f73b596efaaf96b197b86bca71 (diff) |
Merge branch 'add-additional-checks-to-ca-data' into 'master'
Small improvements for Cycle Analytics
See merge request !9153
Diffstat (limited to 'app/assets/javascripts/lib')
-rw-r--r-- | app/assets/javascripts/lib/utils/text_utility.js | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/app/assets/javascripts/lib/utils/text_utility.js b/app/assets/javascripts/lib/utils/text_utility.js index d9370db0cf2..326b7cb7f57 100644 --- a/app/assets/javascripts/lib/utils/text_utility.js +++ b/app/assets/javascripts/lib/utils/text_utility.js @@ -1,5 +1,7 @@ /* eslint-disable func-names, space-before-function-paren, wrap-iife, no-var, no-param-reassign, no-cond-assign, quotes, one-var, one-var-declaration-per-line, operator-assignment, no-else-return, prefer-template, prefer-arrow-callback, no-empty, max-len, consistent-return, no-unused-vars, no-return-assign, max-len */ +require('vendor/latinise'); + (function() { (function(w) { var base; @@ -164,8 +166,14 @@ gl.text.pluralize = function(str, count) { return str + (count > 1 || count === 0 ? 's' : ''); }; - return gl.text.truncate = function(string, maxLength) { + gl.text.truncate = function(string, maxLength) { return string.substr(0, (maxLength - 3)) + '...'; }; + gl.text.dasherize = function(str) { + return str.replace(/[_\s]+/g, '-'); + }; + gl.text.slugify = function(str) { + return str.trim().toLowerCase().latinise(); + }; })(window); }).call(this); |