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)
| Target | Type |
|---|---|
| getFieldDetectionCache | calls |
Impact (Incoming)
| Source | Type |
|---|---|
| handle | uses |