idnumbers
    Preparing search index...

    Function getInputMask

    • The input masks for a country's ID (#129), derived from its METADATA.masks, e.g. getInputMask('BRA')!.imask is [{ mask: '000.000.000-00' }].

      Returns null for an unsupported country code (a non-string one from untyped JavaScript included), or a country registered without masks. Every built-in country has them.

      Parameters

      • countryCode: FormatCountryCode

      Returns InputMask | null

      import { getInputMask } from 'idnumbers';

      const mask = getInputMask('BRA');
      mask?.masks; // ['###.###.###-##']
      mask?.imask; // [{ mask: '000.000.000-00' }]
      mask?.pattern.test('111.444.777-35'); // true