"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.htmlDecodeByRegExp = htmlDecodeByRegExp;
exports.htmlEncodeByRegExp = htmlEncodeByRegExp;

// html标签转义
function htmlEncodeByRegExp(str) {
  var temp = "";
  if (str.length == 0) return "";
  temp = str.replace(/</g, "&lt;");
  temp = temp.replace(/>/g, "&gt;");
  temp = temp.replace(/\'/g, "&#39;");
  temp = temp.replace(/\"/g, "&quot;");
  temp = temp.replace(/\n/g, "<br/>");
  temp = temp.replace(/\+/g, "&#43;");
  return temp;
}

function htmlDecodeByRegExp(str) {
  var temp = "";
  if (str.length == 0) return "";
  temp = str.replace(/<br\/>/g, "\n");
  temp = temp.replace(/&amp;/g, "&");
  temp = temp.replace(/&lt;/g, "<");
  temp = temp.replace(/&gt;/g, ">");
  temp = temp.replace(/&nbsp;/g, " ");
  temp = temp.replace(/&#39;/g, "'");
  temp = temp.replace(/&quot;/g, "\"");
  temp = temp.replace(/&#43;/g, "+");
  return temp;
}