import React from 'react';

// 关键字高亮
var getHighlightNode = function getHighlightNode(text, keyword) {
  if (typeof text !== 'string' || !keyword) return text;
  var index = text.indexOf(keyword);
  var beforeStr = text.substring(0, index);
  var afterStr = text.slice(index + keyword.length);
  var node = index > -1 ? /*#__PURE__*/React.createElement(React.Fragment, null, beforeStr, /*#__PURE__*/React.createElement("div", {
    className: "typography-highlight"
  }, keyword), afterStr) : text;
  return node;
};
export default getHighlightNode;