'use strict';

import React from 'react';
export function highlight(regExp, text, title) {
  if (regExp === void 0) {
    regExp = null;
  }

  if (text === void 0) {
    text = null;
  }

  if (regExp === null || text === null) {
    return React.createElement("span", {
      title: title
    }, text);
  }

  var highlightedText = String(text).replace(regExp, handleTextParts);
  return React.createElement("span", {
    title: title,
    dangerouslySetInnerHTML: {
      __html: highlightedText
    }
  });
}
export function handleTextParts() {
  var parts = [].slice.call(arguments, 1, -2);
  return parts.map(addHighLightTags).join('');
}
export function addHighLightTags(part, index) {
  return index % 2 === 1 ? "<strong>" + part + "</strong>" : part;
}