Skip to content

Instantly share code, notes, and snippets.

@qwertyllo
qwertyllo / validate_spanish_id.js
Last active September 25, 2020 13:11 — forked from afgomez/validate_spanish_id.js
Spanish DNI, CIF, NIE validator
/**
* ValidateSpanishID. Returns the type of document and checks its validity.
*
* Usage:
* ValidateSpanishID( str );
*
* > ValidateSpanishID( '12345678Z' );
* // { type: 'dni', valid: true }
*
* > ValidateSpanishID( 'B83375575' );