How to use the escapeHtml function from hoek
Find comprehensive JavaScript hoek.escapeHtml code examples handpicked from public code repositorys.
GitHub: bloglovin/hoek
228 229 230 231 232 233 234 235 236
### escapeHtml(string) ```javascript var string = '<html> hey </html>'; var escapedString = Hoek.escapeHtml(string); // returns <html> hey </html> ``` ### escapeHeaderAttribute(attribute)
170
1
33
117 118 119 120 121 122 123 124 125 126 127 128 129
return format.replace(/\{\{(\!?)([^}]+)\}\}/g, ($0, isSecure, name) => { const value = Hoek.reach(this.context, name); const normalized = internals.stringify(value, wrapArrays); return (isSecure ? Hoek.escapeHtml(normalized) : normalized); }); } };
0
1
0
65 66 67 68 69 70 71 72 73 74 75 76
internals.Boom.prototype.reformat = function () { this.response.payload.code = this.response.code; this.response.payload.error = Http.STATUS_CODES[this.response.code] || 'Unknown'; if (this.message) { this.response.payload.message = Hoek.escapeHtml(this.message); // Prevent XSS from error message } };
0
0
1
+ 85 other calls in file
123 124 125 126 127 128 129 130 131 132 133 134 135
return format.replace(/\{\{(\!?)([^}]+)\}\}/g, ($0, isSecure, name) => { const value = Hoek.reach(this.context, name); const normalized = internals.stringify(value, wrapArrays); return (isSecure && this.options.escapeHtml ? Hoek.escapeHtml(normalized) : normalized); }); } };
0
0
0
hoek.assert is the most popular function in hoek (1712 examples)