diff options
author | Kushal Pandya <kushal@gitlab.com> | 2018-02-07 18:27:44 +0530 |
---|---|---|
committer | Kushal Pandya <kushal@gitlab.com> | 2018-02-07 19:00:11 +0530 |
commit | 99a5c4b93293296b8585da9cb02f04ce9e7a89d3 (patch) | |
tree | f65b12d3611ccbac7bca60ccbd8546f70dfa1b95 /app/assets/javascripts/lib | |
parent | f718d6414b4f6ab5eb5a344a7e1e6fba34a37349 (diff) | |
download | gitlab-ce-99a5c4b93293296b8585da9cb02f04ce9e7a89d3.tar.gz |
Add `convertToCamelCase` helper method
Diffstat (limited to 'app/assets/javascripts/lib')
-rw-r--r-- | app/assets/javascripts/lib/utils/text_utility.js | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/app/assets/javascripts/lib/utils/text_utility.js b/app/assets/javascripts/lib/utils/text_utility.js index 62d80c4a649..94d03621bff 100644 --- a/app/assets/javascripts/lib/utils/text_utility.js +++ b/app/assets/javascripts/lib/utils/text_utility.js @@ -73,3 +73,10 @@ export function capitalizeFirstCharacter(text) { * @returns {String} */ export const stripHtml = (string, replace = '') => string.replace(/<[^>]*>/g, replace); + +/** + * Converts snake_case string to camelCase + * + * @param {*} string + */ +export const convertToCamelCase = string => string.replace(/(_\w)/g, s => s[1].toUpperCase()); |