getFieldDetectionCacheForUrl function infrastructure exported ✓ 100.0%

Last updated: 2026-02-24T21:07:57.500Z

Metrics

LOC: 18 Complexity: 5 Params: 2 Coverage: 100.0% (8/8 lines, 3x executed)

Signature

getFieldDetectionCacheForUrl( url: string, ): : Promise<FieldDetectionCacheEntry | null>

Summary

Retrieves the cached detection result for a specific URL. Falls back to origin + path matching when an exact URL match isn't found.

Tags

#@param url - Full page URL#@returns The matching cache entry, or `null`

Source Code

export async function getFieldDetectionCacheForUrl(
  url: string,
): Promise<FieldDetectionCacheEntry | null> {
  const entries = await getFieldDetectionCache();
  const exact = entries.find((entry) => entry.url === url);
  if (exact) return exact;

  try {
    const u = new URL(url);
    return (
      entries.find(
        (entry) => entry.origin === u.origin && entry.path === u.pathname,
      ) ?? null
    );
  } catch {
    return null;
  }
}

Dependencies (Outgoing)

graph LR getFieldDetectionCacheForUrl["getFieldDetectionCacheForUrl"] getFieldDetectionCache["getFieldDetectionCache"] getFieldDetectionCacheForUrl -->|calls| getFieldDetectionCache style getFieldDetectionCacheForUrl fill:#dbeafe,stroke:#2563eb,stroke-width:2px click getFieldDetectionCacheForUrl "df99bb80d6972b4a.html" click getFieldDetectionCache "8f2869c3e935ff86.html"
TargetType
getFieldDetectionCache calls

Impact (Incoming)

graph LR getFieldDetectionCacheForUrl["getFieldDetectionCacheForUrl"] handle["handle"] handle -->|uses| getFieldDetectionCacheForUrl style getFieldDetectionCacheForUrl fill:#dbeafe,stroke:#2563eb,stroke-width:2px click getFieldDetectionCacheForUrl "df99bb80d6972b4a.html" click handle "8b929c06f047f82c.html"
SourceType
handle uses