"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports["default"] = TextHighlighter;

function TextHighlighter(val, keyWords, HighlightColor) {
  val = "".concat(val);
  var color = HighlightColor || "#dd182b";
  var reg = new RegExp(keyWords, "g");

  if (val.indexOf(keyWords) !== -1 && keyWords !== "") {
    // 找到并且不为空
    return val.replace(reg, "<font color=\"".concat(color, "\">").concat(keyWords, "</font>"));
  }

  return val;
}