getHighlightSegments
getHighlightSegments(
text,query,caseSensitive?):HighlightSegment[]
Defined in: src/components/feedback/LogView/logViewUtils.ts:21
Split text into alternating non-match / match segments for query.
Pure and allocation-light: an empty (or whitespace-only) query returns a
single non-match segment so callers can render uniformly. Matching is
case-insensitive unless caseSensitive is set. All occurrences are marked.
Parameters
Section titled “Parameters”string
string
caseSensitive?
Section titled “caseSensitive?”boolean = false
Returns
Section titled “Returns”Example
Section titled “Example”getHighlightSegments('abcABC', 'bc')// → [{text:'a',match:false},{text:'bc',match:true},// {text:'A',match:false},{text:'BC',match:true}]