code: function(s) {
        s = String(s === null ? "" : s);
        return s.replace(/&(?!\w+;)|["'<>\\]/g, function(s) {
          switch(s) {
          case "&": return "&amp;";
          case '"': return '&quot;';
          case "'": return '&#39;';
          case "<": return "&lt;";
          case ">": return "&gt;";
          default: return s;
          }
        });
      }
docs: /*
  Does away with nasty characters