All files / apps/developer-portal/layers/snapshot/shared deps.ts

100% Statements 4/4
100% Branches 4/4
100% Functions 2/2
100% Lines 3/3

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11      38x     38x     19x  
import type { DepsArtifact } from "./types/DepsArtifact.ts";
import type { VulnerabilityAdvisory } from "./types/VulnerabilityAdvisory.ts";
 
const SEVERITIES = ["critical", "high", "moderate", "low", "info"] as const;
 
/** The most severe band with an advisory in it, so one figure can take that band's tone. */
export const worstSeverity = (
    counts: DepsArtifact["vulnerabilities"] | undefined,
): VulnerabilityAdvisory["severity"] | null =>
    counts ? (SEVERITIES.find((severity) => counts[severity] > 0) ?? null) : null;