MCPcopy
hub / github.com/promptfoo/promptfoo / containsString

Function containsString

test/remoteGrading.test.ts:13–24  ·  view source on GitHub ↗
(value: unknown, needle: string)

Source from the content-addressed store, hash-verified

11const mockLoggerDebug = vi.hoisted(() => vi.fn());
12
13function containsString(value: unknown, needle: string): boolean {
14 if (typeof value === 'string') {
15 return value.includes(needle);
16 }
17 if (Array.isArray(value)) {
18 return value.some((item) => containsString(item, needle));
19 }
20 if (value && typeof value === 'object') {
21 return Object.values(value).some((item) => containsString(item, needle));
22 }
23 return false;
24}
25
26vi.mock('../src/cache', () => ({
27 fetchWithCache: vi.fn(),

Callers 1

Calls 1

valuesMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…