| 12
 3
 4
 5
 6
 7
 8
 9
 10
 11
 12
 13
 14
 15
 16
 17
 
 | function toCamel(str) {if (!str.indexOf('-') || typeof str !== 'string') throw new Error('the param is invalidation')
 var strArr = str.split('-')
 var _str = ''
 strArr.forEach(function (v, k) {
 if(k ===  0){
 _str += v.toLowerCase()
 }else {
 _str += (v[0].toUpperCase()+v.slice(1).toLowerCase())
 }
 })
 
 return _str
 }
 
 var res = toCamel('Eric-is-a-gOoD-maN')
 console.log(res)
 
 |