1 | "use strict";
|
2 | var __importDefault = (this && this.__importDefault) || function (mod) {
|
3 | return (mod && mod.__esModule) ? mod : { "default": mod };
|
4 | };
|
5 | const unescape_html_1 = __importDefault(require("./unescape_html"));
|
6 | const htmlEntityMap = {
|
7 | '&': '&',
|
8 | '<': '<',
|
9 | '>': '>',
|
10 | '"': '"',
|
11 | '\'': ''',
|
12 | '`': '`',
|
13 | '/': '/',
|
14 | '=': '='
|
15 | };
|
16 | function escapeHTML(str) {
|
17 | if (typeof str !== 'string')
|
18 | throw new TypeError('str must be a string!');
|
19 | str = (0, unescape_html_1.default)(str);
|
20 |
|
21 | return str.replace(/[&<>"'`/=]/g, a => htmlEntityMap[a]);
|
22 | }
|
23 | module.exports = escapeHTML;
|
24 |
|
\ | No newline at end of file |