0
0
mirror of https://github.com/naturalcrit/homebrewery.git synced 2025-12-24 18:32:41 +00:00

Rename sanitizeHtml function to escapeTextForHtmlDisplay which better describes it's actual function

This commit is contained in:
G.Ambatte
2021-01-21 07:37:50 +13:00
parent e8135fcbb4
commit 8060ed5f8e

View File

@@ -34,10 +34,9 @@ HomebrewSchema.methods.sanatize = function(full=false){
return brew;
};
HomebrewSchema.methods.sanitizeHtml = function(){
const brew = this.toJSON();
HomebrewSchema.methods.escapeTextForHtmlDisplay = function(){
const replaceStrings = { '&': '&amp;', '<': '&lt;', '>': '&gt;' };
text = brew.text;
text = this.text;
for (const replaceStr in replaceStrings) {
text = text.replaceAll(replaceStr, replaceStrings[replaceStr]);
}