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.
12 lines
359 B
12 lines
359 B
/**
|
|
* @description: -转驼峰
|
|
* @param {String} str 字符串
|
|
* @param {String} mark 转换符号:-
|
|
* @return {String}
|
|
* @example: toHump('border-radius') // borderRadius
|
|
*/
|
|
export default function toHump(str = '', mark = '-') {
|
|
return str.replace(new RegExp(`${mark}(\\w)`, 'g'), function (all, letter) {
|
|
return letter.toUpperCase();
|
|
});
|
|
}
|
|
|