/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at . */
// @flow
// Maybe reuse file search's functions?
import React from "react";
import type { Match } from "../components/ProjectSearch";
export function highlightMatches(lineMatch: Match) {
const { value, matchIndex, match } = lineMatch;
const len = match.length;
return (
{value.slice(0, matchIndex)}
{value.substr(matchIndex, len)}
{value.slice(matchIndex + len, value.length)}
);
}