diff options
Diffstat (limited to 'app/assets/javascripts/lib/utils/text_utility.js')
-rw-r--r-- | app/assets/javascripts/lib/utils/text_utility.js | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/app/assets/javascripts/lib/utils/text_utility.js b/app/assets/javascripts/lib/utils/text_utility.js index 879f94a26ec..250980919dd 100644 --- a/app/assets/javascripts/lib/utils/text_utility.js +++ b/app/assets/javascripts/lib/utils/text_utility.js @@ -8,7 +8,7 @@ * @returns {String} */ export const addDelimiter = text => - (text ? text.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ',') : text); + text ? text.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ',') : text; /** * Returns '99+' for numbers bigger than 99. @@ -94,9 +94,7 @@ export function capitalizeFirstCharacter(text) { * @return {String} */ export function getFirstCharacterCapitalized(text) { - return text - ? text.charAt(0).toUpperCase() - : ''; + return text ? text.charAt(0).toUpperCase() : ''; } /** @@ -136,10 +134,9 @@ export const convertToSentenceCase = string => { * e.g. HelloWorld => Hello World * * @param {*} string -*/ -export const splitCamelCase = string => ( + */ +export const splitCamelCase = string => string - .replace(/([A-Z]+)([A-Z][a-z])/g, ' $1 $2') - .replace(/([a-z\d])([A-Z])/g, '$1 $2') - .trim() -); + .replace(/([A-Z]+)([A-Z][a-z])/g, ' $1 $2') + .replace(/([a-z\d])([A-Z])/g, '$1 $2') + .trim(); |