MCPcopy
hub / github.com/jabbany/CommentCoreLibrary / decodeHTMLEnt

Function decodeHTMLEnt

experimental/scripting/deprecated/bscript.js:13–30  ·  view source on GitHub ↗
(s)

Source from the content-addressed store, hash-verified

11 };
12
13 var decodeHTMLEnt = function(s){
14 s = s.replace(/&#(\d+);?/g, function (_, code) {
15 return String.fromCharCode(code);
16 }).replace(/&#[xX]([A-Fa-f0-9]+);?/g, function (_, hex) {
17 return String.fromCharCode(parseInt(hex, 16));
18 }).replace(/&([^;\W]+;?)/g, function (m, e) {
19 var ee = e.replace(/;$/, '');
20 var target = ENTITIES[e] || (e.match(/;$/) && ENTITIES[ee]);
21 if (typeof target === 'number') {
22 return String.fromCharCode(target);
23 }else if (typeof target === 'string') {
24 return target;
25 }else {
26 return m;
27 }
28 })
29 return s;
30 };
31 var _ = function (type, props, children, callback) {
32 var elem = null;
33 if (type === "text") {

Callers 1

bscript.jsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected