camelize方法,转换为驼峰命名风格:
function camelize (target) {
if (target.indexOf('_') < 0 && target.indexOf('_') < 0) return target;
return target.replace(/[-_][^-_]/g , function(match){
return match[1].toUpperCase();
})
}
underscored方法,转换为下划线风格:
function underscored(target){
return target.replace(/([a-zd])([A-Z])/g , '$1_$2').replace(/-/g , '_').toLowerCase();
}