nationid - v2.2.1
    Preparing search index...

    Function toMrzField9

    Public algorithm primitives. Tree-shakable subpath: nationid/algorithms.

    Each function is a pure mathematical primitive with cited spec.

    • Right-pad a printed passport number to the 9-char MRZ field with <. Useful when the issued number is shorter than 9 chars.

      Lowercase letters are uppercased before validation, so callers do not need to pre-normalize case.

      Parameters

      • printed: string

        The number as printed on the data page (1..9 chars).

      Returns string

      A 9-char string in the MRZ alphabet, right-padded with <.

      ICAO_TOO_LONG if printed exceeds 9 chars.

      ICAO_INVALID_CHAR if printed contains characters outside [0-9A-Za-z] (filler < is added by the function, not accepted as input).

      import { toMrzField9 } from "nationid/algorithms";

      toMrzField9("L898902C"); // "L898902C<"
      toMrzField9("abc123"); // "ABC123<<<"