Skip to main content
Version: v0.0.2

Function: classifyCandidates()

classifyCandidates(candidates): DetectResult

Classify a list of matched candidate formats into a DetectResult: exactly one → certain, zero → none, two-or-more → ambiguous (all with format null unless certain). Split out and exported so the ambiguity contract is directly testable. It is otherwise unreachable while every signature is disjoint, and it must stay a detected ambiguity, never a mis-route.

Parameters

candidates

readonly CosyteFormat[]

The formats whose signatures matched the input.

Returns

DetectResult

The classified DetectResult.

Example

import { classifyCandidates } from "@cosyte/cli";

classifyCandidates(["hl7"]).confidence; // => "certain"
classifyCandidates([]).confidence; // => "none"
classifyCandidates(["hl7", "fhir"]).confidence; // => "ambiguous"