Skip to content

Instantly share code, notes, and snippets.

@PabloVallejo
Created July 25, 2013 16:48
Show Gist options
  • Save PabloVallejo/6081617 to your computer and use it in GitHub Desktop.
Save PabloVallejo/6081617 to your computer and use it in GitHub Desktop.
hyphenToCamelCase
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