ReadonlycodeReadonlyconfidenceReadonlycountryOptional ReadonlyformattedOptional regex matching the formatted form a user might paste.
ReadonlyhasTrue iff the spec includes a check-digit algorithm we trust to enforce.
Readonlylabeli18n key path, e.g. documents.SV_DUI.label. UI consumers resolve to localized text.
ReadonlymaskMask pattern (cleave-style: 0=digit, A=uppercase letter, *=alphanumeric).
ReadonlyrawRegex matching the normalized form (no separators, uppercase).
ReadonlyscopeReverse of normalize, applies the canonical mask. Returns input unchanged if invalid.
Strip separators, uppercase, trim. Idempotent.
Returns true iff input passes regex AND (when applicable) check digit.
Definition of one document type.
Each country file under
src/countries/<cc>/exports one or more specs.Parametrized over the document type code so the public root
getSpec<C>(code)can narrow the returned spec to the exactCthe caller passed in. Existing country files annotate their specs as: DocumentSpec(no type argument), which resolves toDocumentSpec<DocumentTypeCode>via the default — no per-country changes required.