nationid - v2.2.1
    Preparing search index...

    Function validate

    • Validate a Brazilian (BR) identity or tax document.

      Parameters

      • code:
            | "BR_CPF"
            | "BR_CNPJ"
            | "BR_CNH"
            | "BR_TITULO_ELEITOR"
            | "BR_PIS"
            | "BR_PASAPORTE"
            | ShortCode

        Document type, either fully-qualified (BR_CPF, BR_CNPJ, ...) or short (CPF, CNPJ, CNH, TITULO_ELEITOR, PIS, PASAPORTE).

      • input: string

        Raw document string (formatting tolerated).

      Returns boolean

      true if the value passes BR-specific validation rules.

      import { validate } from "nationid/br";
      validate("BR_CPF", "111.444.777-35"); // true
      validate("CNPJ", "11.222.333/0001-81");