MCPcopy Index your code
hub / github.com/simstudioai/sim / recordIfMatch

Function recordIfMatch

apps/sim/lib/logs/log-views.ts:220–238  ·  view source on GitHub ↗
(
  text: string,
  field: GrepSpanMatch['field'],
  span: TraceSpan,
  state: GrepState
)

Source from the content-addressed store, hash-verified

218}
219
220function 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
240async function grepField(
241 value: unknown,

Callers 2

grepFieldFunction · 0.85
walkFunction · 0.85

Calls 4

doneFunction · 0.85
snippetAroundFunction · 0.85
testMethod · 0.80
pushMethod · 0.45

Tested by

no test coverage detected