nationid - v2.2.1
    Preparing search index...

    Function validate

    • Validate a Spanish (ES) identity, tax or social-security document.

      Parameters

      • code: "ES_DNI" | "ES_NIE" | "ES_NIF_PJ" | "ES_NUSS" | "ES_PASAPORTE" | ShortCode

        Document type, either fully-qualified (ES_DNI, ES_NIE, ES_NIF_PJ, ES_NUSS, ES_PASAPORTE) or short (DNI, NIE, NIF_PJ, CIF, NUSS, PASAPORTE).

      • input: string

        Raw document string (formatting tolerated).

      Returns boolean

      true if the value passes ES-specific validation rules.

      import { validate } from "nationid/es";
      validate("ES_DNI", "12345678Z"); // true
      validate("NIF_PJ", "A58818501");