import React from 'react';
export var highlightHTML = (pattern, content) => {
  var highlightedContent;

  if (!pattern) {
    highlightedContent = content;
  } else {
    try {
      var target = new RegExp("(".concat(pattern, ")"), 'gi');
      var contentArray = content.split(target);
      highlightedContent = contentArray.map((str, index) => {
        if (target.test(str)) {
          return React.createElement("span", {
            key: index,
            className: 'hi'
          }, str);
        }

        return str;
      });
    } catch (e) {
      highlightedContent = content;
    }
  }

  return highlightedContent;
};
//# sourceMappingURL=highlight.js.map