'use strict';
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
var react_1 = __importDefault(require("react"));
function highlight(regExp, text, title) {
    if (regExp === void 0) { regExp = null; }
    if (text === void 0) { text = null; }
    if (title === void 0) { title = ''; }
    if (regExp === null || text === null) {
        return react_1.default.createElement("span", { title: title }, text);
    }
    var highlightedText = String(text).replace(regExp, handleTextParts);
    return react_1.default.createElement("span", { title: title, dangerouslySetInnerHTML: { __html: highlightedText } });
}
exports.highlight = highlight;
function handleTextParts() {
    var parts = [].slice.call(arguments, 1, -2);
    return parts.map(addHighLightTags).join('');
}
exports.handleTextParts = handleTextParts;
function addHighLightTags(part, index) {
    return index % 2 === 1 ? "<strong>" + part + "</strong>" : part;
}
exports.addHighLightTags = addHighLightTags;
//# sourceMappingURL=utils.js.map