Created
July 25, 2013 16:48
-
-
Save PabloVallejo/6081617 to your computer and use it in GitHub Desktop.
hyphenToCamelCase
This file contains hidden or 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
diff --git a/assets/js/helpers/utilities.js b/assets/js/helpers/utilities.js | |
index a34e884..2922d1d 100644 | |
--- a/assets/js/helpers/utilities.js | |
+++ b/assets/js/helpers/utilities.js | |
@@ -296,6 +296,19 @@ | |
}); | |
} | |
+ | |
+ /** | |
+ * Converts a dashed string `sample-string` to a | |
+ * cammelcased one `` | |
+ */ | |
+ , hyphenToCamelCase: function( string ) { | |
+ | |
+ return string.replace( /([-][a-z])/g, function( $1 ) { | |
+ | |
+ return $1[ 1 ] . toUpperCase(); | |
+ }); | |
+ } | |
+ | |
/** | |
* Converts hiphens to underscores | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment