JSFiddle - React, Tailwind, and code Playground

by smacky311

JavaScript

//prototype helper
Function.prototype.method = function(name, func) {
  this.prototype[name] = func;
  return this;  
};

//Modules
String.method('deentityify',function() {
    
    var entity = {
        quot: '"',
        lt:   '<',
        gt:   '>'
    };
    
    return function() {
        return this.replace(/&([^&;]+);/g,
                            function (a,b) {
                                var r = entity[b];
                                return typeof r === 'string' ? r : a;
                            }
                           );
    }
}());

document.writeln('&lt;&quot;&gt;'.deentityify());