idnumbers
    Preparing search index...

    Function getCountryIdFormat

    • Get information about the ID number format for a specific country.

      Delegates to the registry. Aliases (e.g. "IN", "jp") are resolved to their primary alpha-3 key. Returns null for unregistered country codes, including a non-string one from untyped JavaScript.

      Parameters

      • countryCode: string

      Returns IdFormat | null

      import { getCountryIdFormat } from 'idnumbers';

      const format = getCountryIdFormat('TWN');
      format?.idType; // 'National Identification Card'
      format?.format; // 'X#########'
      format?.length; // { min: 10, max: 10 }
      format?.hasChecksum; // true

      getCountryIdFormat('XX'); // null