MCPcopy Index your code
hub / github.com/promptfoo/promptfoo / getJsonValueForFetchCacheKey

Function getJsonValueForFetchCacheKey

src/cache.ts:344–360  ·  view source on GitHub ↗
(value: unknown, fieldName?: string)

Source from the content-addressed store, hash-verified

342}
343
344function getJsonValueForFetchCacheKey(value: unknown, fieldName?: string): unknown {
345 if (typeof value === 'string') {
346 return getStringForFetchCacheKey(value, fieldName);
347 }
348 if (Array.isArray(value)) {
349 return value.map((item) => getJsonValueForFetchCacheKey(item, fieldName));
350 }
351 if (value && typeof value === 'object') {
352 return Object.fromEntries(
353 Object.entries(value).map(([key, nestedValue]) => [
354 key,
355 getJsonValueForFetchCacheKey(nestedValue, key),
356 ]),
357 );
358 }
359 return value;
360}
361
362function getBodyStringForFetchCacheKey(value: string): unknown {
363 try {

Callers 1

Calls 1

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…