Port escapeHtml method to string utility module.

This commit is contained in:
Alex Tselegidis 2022-01-17 17:49:29 +01:00
parent d333869952
commit 1986438357
1 changed files with 17 additions and 1 deletions

View File

@ -18,6 +18,8 @@ window.App.Utils.String = (function () {
/**
* Upper case the first letter of the provided string.
*
* Old Name: GeneralFunctions.upperCaseFirstLetter
*
* @param {String} value
*
* @returns {string}
@ -26,7 +28,21 @@ window.App.Utils.String = (function () {
return value.charAt(0).toUpperCase() + value.slice(1);
}
/**
* Escape HTML content with the use of jQuery.
*
* Old Name: GeneralFunctions.escapeHtml
*
* @param {String} content
*
* @return {String}
*/
function escapeHtml(content) {
return $('<div/>').text(content).html();
}
return {
upperCaseFirstLetter
upperCaseFirstLetter,
escapeHtml
};
})();