下划线命名转驼峰命名

function toUpperCase(str) {
    let nstr = str.replace(/(?:_)+([^_])/g, function ($0, $1) {
        return $1.toUpperCase();
    })
    nstr = nstr.replace(nstr[0], nstr[0].toLowerCase())
    return nstr
}
posted @ 2022-10-26 16:58  田心夂  阅读(14)  评论(0)    收藏  举报