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. * Upper case the first letter of the provided string.
* *
* Old Name: GeneralFunctions.upperCaseFirstLetter
*
* @param {String} value * @param {String} value
* *
* @returns {string} * @returns {string}
@ -26,7 +28,21 @@ window.App.Utils.String = (function () {
return value.charAt(0).toUpperCase() + value.slice(1); 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 { return {
upperCaseFirstLetter upperCaseFirstLetter,
escapeHtml
}; };
})(); })();