Utilities to work with the Spanish DNI
$ npm install @muxed/dni-utils
Import the functions you want
import {
isCif,
isNie,
isNif,
} from "./../src/modules/validator";
Functions available
const dni = '54148871V';
// Check validity (any NIE, NIF or CIF). Return `true` or `false`.
isValid(dni);
// Check validity (NIE, NIF or CIF) . Return `true` or `false`.
isNif(dni);
isNie(dni);
isCif(dni);
// Return an Object with society type and province. Format: `{ society: String, province: String }`
dataNif(dni);
// Return the type of DNI (`NIE`, `NIF` or `CIF`) or `INVALID`.
typeDNI(dni);
IMPORTANT: Obsolete CIFs isn't supported (return INVALID)
Install the Jest dependencies if not in global
$ npm install
Run the tests
$ npm run test
Please read CONTRIBUTING for details on our CODE OF CONDUCT, and the process for submitting pull requests.
MIT © MuXeD
⌨️ with ❤︎ by MuXeD