From 198643835733aef50e184daa3674766f65c21689 Mon Sep 17 00:00:00 2001 From: Alex Tselegidis Date: Mon, 17 Jan 2022 17:49:29 +0100 Subject: [PATCH] Port escapeHtml method to string utility module. --- assets/js/utils/string.js | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/assets/js/utils/string.js b/assets/js/utils/string.js index e03c4e2d..7b81cbb9 100644 --- a/assets/js/utils/string.js +++ b/assets/js/utils/string.js @@ -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 $('
').text(content).html(); + } + return { - upperCaseFirstLetter + upperCaseFirstLetter, + escapeHtml }; })();