Skip to content

Instantly share code, notes, and snippets.

@msroot
Forked from cyberfox/humanize.js
Created August 4, 2013 16:00
Show Gist options
  • Select an option

  • Save msroot/6150804 to your computer and use it in GitHub Desktop.

Select an option

Save msroot/6150804 to your computer and use it in GitHub Desktop.
com = { cyberfox: {} };
/**
* Convert a property name into a human readable string by replacing _ with
* spaces, and upcasing the first letter of each word.
*
* @param {string} property The property name to convert into a readable name.
* @return {string} The property name converted to a friendly readable format.
* @private
*/
com.cyberfox.humanize_ = function(property) {
return property.replace(/_/g, ' ')
.replace(/(\w+)/g, function(match) {
return match.charAt(0).toUpperCase() + match.slice(1);
});
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment