Sha256: 915761283f16313e6773073e83d1a7d84c103b4f44bac338b84e56f487b6bee6
Contents?: true
Size: 1.21 KB
Versions: 7
Compression:
Stored size: 1.21 KB
Contents
/** * Old versions of String extensions. Not sure if we should be augmenting String like the above so have left this for reference */ // /** // * @param {String} str A string to be capitalized // * @returns A capitalized string (e.g. "some test sentence" becomes "Some test sentence") // * @type String // */ // String.capitalize = function(str) { // return str.charAt(0).toUpperCase() + str.substr(1).toLowerCase(); // }; // // /** // * @param {String} str A string to be turned into title case // * @returns The string in Title Case (e.g. "some test sentence" becomes "Some Test Sentence") // * @type String // */ // String.titleize = function(str) { // return str.replace(/\w\S*/g, function(txt){return txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase();}); // }; // // /** // * Takes any string and de-underscores and uppercases it // * e.g. long_underscored_string => LongUnderscoredString // */ // String.camelize = function(class_name_string) { // return String.titleize(class_name_string.replace(/_/g, " ")).replace(/ /g, ""); // // // this feels nicer, sadly no collect function (yet) though // // class_name_string.split("_").collect(function(e) {return String.capitalize(e)}).join(""); // };
Version data entries
7 entries across 6 versions & 1 rubygems