Created
December 23, 2019 12:25
-
-
Save luislobo14rap/e44c48b8a51b68058ec45bf05d08c737 to your computer and use it in GitHub Desktop.
capitalizeCase.js
This file contains hidden or 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
// capitalizeCase.js v1 | |
function capitalizeCase(text){ | |
return text.toLowerCase().replace(/\b[a-z]/g, function(value){ | |
return value.toUpperCase(); | |
}); | |
}; | |
String.prototype.capitalizeCase = function(){ | |
return capitalizeCase(this.toString()); | |
}; | |
if(typeof jQuery != 'undefined'){ | |
jQuery.fn.extend({ | |
capitalizeCase: function(){ | |
return capitalizeCase($(this).text()); | |
} | |
}); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment