Created
July 24, 2015 12:46
-
-
Save ihorkatkov/c4dbfef7651fd4c97ca3 to your computer and use it in GitHub Desktop.
[js] Camelize. Преобразует строки вида «my-short-string» в «myShortString».
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function camelize(str) { | |
var arr = str.split('-'); | |
for (var i = 1; i < arr.length; i++) { | |
arr[i]= arr[i][0].toUpperCase() + arr[i].slice(1); | |
} | |
str = arr.join(''); | |
return str; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment