Function
recordIfMatch
(
text: string,
field: GrepSpanMatch['field'],
span: TraceSpan,
state: GrepState
)
Source from the content-addressed store, hash-verified
| 218 | } |
| 219 | |
| 220 | function recordIfMatch( |
| 221 | text: string, |
| 222 | field: GrepSpanMatch['field'], |
| 223 | span: TraceSpan, |
| 224 | state: GrepState |
| 225 | ): void { |
| 226 | if (done(state)) return |
| 227 | state.regex.lastIndex = 0 |
| 228 | if (!state.regex.test(text)) return |
| 229 | state.regex.lastIndex = 0 |
| 230 | state.matches.push({ |
| 231 | spanId: span.id, |
| 232 | blockId: span.blockId, |
| 233 | name: span.name, |
| 234 | field, |
| 235 | snippet: snippetAround(text, state.regex, state.maxSnippetChars), |
| 236 | }) |
| 237 | if (state.matches.length >= state.maxMatches) state.truncated = true |
| 238 | } |
| 239 | |
| 240 | async function grepField( |
| 241 | value: unknown, |
Tested by
no test coverage detected