StackGenVis: Alignment of Data, Algorithms, and Models for Stacking Ensemble Learning Using Performance Metrics https://doi.org/10.1109/TVCG.2020.3030352
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
StackGenVis/frontend/node_modules/bootstrap-vue/esm/utils/startcase.js

33 lines
1.1 KiB

4 years ago
/**
* Converts a string, including strings in camelCase or snake_case, into Start Case (a variant
* of Title Case where all words start with a capital letter), it keeps original single quote
* and hyphen in the word.
*
* Copyright (c) 2017 Compass (MIT)
* https://github.com/UrbanCompass/to-start-case
* @author Zhuoyuan Zhang <https://github.com/drawyan>
* @author Wei Wang <https://github.com/onlywei>
*
*
* 'management_companies' to 'Management Companies'
* 'managementCompanies' to 'Management Companies'
* `hell's kitchen` to `Hell's Kitchen`
* `co-op` to `Co-op`
*
* @param {String} str
* @returns {String}
*/
// Precompile regular expressions for performance
var RX_UNDERSCORE = /_/g;
var RX_LOWER_UPPER = /([a-z])([A-Z])/g;
var RX_START_SPACE_WORD = /(\s|^)(\w)/g;
var startCase = function startCase(str) {
return str.replace(RX_UNDERSCORE, ' ').replace(RX_LOWER_UPPER, function (str, $1, $2) {
return $1 + ' ' + $2;
}).replace(RX_START_SPACE_WORD, function (str, $1, $2) {
return $1 + $2.toUpperCase();
});
};
export default startCase;