summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/lib
diff options
context:
space:
mode:
authorFilipa Lacerda <filipa@gitlab.com>2017-10-10 07:47:42 +0000
committerPhil Hughes <me@iamphill.com>2017-10-10 07:47:42 +0000
commit67f4408d741b62e61f1fd767b4724727c489b42c (patch)
tree7e7eb50c2797ad968bb238472036d6b2d39c4555 /app/assets/javascripts/lib
parentd6170ce4d8a0cbfd8552531c29163e44549222cf (diff)
downloadgitlab-ce-67f4408d741b62e61f1fd767b4724727c489b42c.tar.gz
Fix bad type checking to prevent 0 count badge to be shown
Diffstat (limited to 'app/assets/javascripts/lib')
-rw-r--r--app/assets/javascripts/lib/utils/text_utility.js14
1 files changed, 11 insertions, 3 deletions
diff --git a/app/assets/javascripts/lib/utils/text_utility.js b/app/assets/javascripts/lib/utils/text_utility.js
index 021f936a4fa..f776829f69c 100644
--- a/app/assets/javascripts/lib/utils/text_utility.js
+++ b/app/assets/javascripts/lib/utils/text_utility.js
@@ -1,4 +1,4 @@
-/* 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, vars-on-top */
+/* eslint-disable import/prefer-default-export, 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, vars-on-top */
import 'vendor/latinise';
@@ -13,9 +13,17 @@ if ((base = w.gl).text == null) {
gl.text.addDelimiter = function(text) {
return text ? text.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",") : text;
};
-gl.text.highCountTrim = function(count) {
+
+/**
+ * Returns '99+' for numbers bigger than 99.
+ *
+ * @param {Number} count
+ * @return {Number|String}
+ */
+export function highCountTrim(count) {
return count > 99 ? '99+' : count;
-};
+}
+
gl.text.randomString = function() {
return Math.random().toString(36).substring(7);
};