📜  camelcase 到普通文本 javascript 代码示例

📅  最后修改于: 2022-03-11 15:03:06.237000             🧑  作者: Mango

代码示例3
String.prototype.toCamelCase = function () {
    let STR = this.toLowerCase()
        .trim()
        .split(/[ -_]/g)
        .map(word => word.replace(word[0], word[0].toString().toUpperCase()))
        .join('');
    return STR.replace(STR[0], STR[0].toLowerCase());
};