Last active
December 17, 2015 12:29
-
-
Save adam-lynch/5609705 to your computer and use it in GitHub Desktop.
Converts hypenated strings to camelCase. E.g. "hello-world" -> "helloWorld", "this-is-a-gist" -> "thisIsAGist", etc
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
/** | |
* @param str string | |
* | |
* @return string | |
* | |
* @author adam-lynch | |
*/ | |
var convertHyphenatedToCamelCase = function( str ){ | |
return str.replace( /-([a-z])/g, function( matches ){ | |
return matches[1].toUpperCase(); | |
} ); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment