Skip to content

Commit

Permalink
Update 字符串变驼峰.js
Browse files Browse the repository at this point in the history
  • Loading branch information
Rain120 authored Apr 4, 2018
1 parent ad40cd9 commit 6d87b16
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions 字符串变驼峰.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
// asd-fgh-jkl ===>asdFghJkl 小驼峰
var toCapitalize = function(str) {
return str.replace(/-\w/g, function(s) {
return s.slice(1).toUpperCase();
});
}

function firstUpperCase(str) {
return str.toLowerCase().replace(/^\S/g,function(s){return s.toUpperCase();});
}
Expand Down

0 comments on commit 6d87b16

Please sign in to comment.