Skip to content
Entangle UI v0.13.0

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.

string

string

boolean = false

HighlightSegment[]

getHighlightSegments('abcABC', 'bc')
// → [{text:'a',match:false},{text:'bc',match:true},
// {text:'A',match:false},{text:'BC',match:true}]