UNPKG

529 BJavaScriptView Raw
1"use strict";
2const htmlEntityMap = {
3 '&': '&',
4 '&lt;': '<',
5 '&gt;': '>',
6 '&quot;': '"',
7 '&#39;': '\'',
8 '&#96;': '`',
9 '&#x2F;': '/',
10 '&#x3D;': '='
11};
12const regexHtml = new RegExp(Object.keys(htmlEntityMap).join('|'), 'g');
13const unescapeHTML = (str) => {
14 if (typeof str !== 'string')
15 throw new TypeError('str must be a string!');
16 return str.replace(regexHtml, a => htmlEntityMap[a]);
17};
18module.exports = unescapeHTML;
19//# sourceMappingURL=unescape_html.js.map
\No newline at end of file