Skip to content

Instantly share code, notes, and snippets.

@PabloVallejo
Created July 25, 2013 20:06
Show Gist options
  • Save PabloVallejo/6083252 to your computer and use it in GitHub Desktop.
Save PabloVallejo/6083252 to your computer and use it in GitHub Desktop.
cammelCaseToSpace
diff --git a/assets/js/helpers/utilities.js b/assets/js/helpers/utilities.js
index a34e884..86ac187 100644
--- a/assets/js/helpers/utilities.js
+++ b/assets/js/helpers/utilities.js
@@ -297,6 +297,18 @@
}
/**
+ * Converts a cammelcased string to a spaced one.
+ * `sampleStringHere` => `sample string here`
+ */
+ , cammelCaseToSpace: function( string ) {
+
+ return string.replace( /([A-Z])/g, function( $1 ) {
+
+ return " " + $1 . toLowerCase();
+ });
+ }
+
+ /**
* Converts hiphens to underscores
*/
, hyphenToUnderscore: function( string ) {
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment