Created
October 8, 2012 20:08
-
-
Save aaronsnoswell/3854646 to your computer and use it in GitHub Desktop.
Classify
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
/* Formats a human-, or machine-friendly string to be suitable for use as a | |
* CSS class name. | |
*/ | |
var classify = function(text) { | |
text = (text != undefined) ? text : ""; | |
return text.toLowerCase().replace(/\s/g, "_").replace(/[^a-zA-Z0-9_]/g, ""); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment