@muxed/dni-utils
v2.0.2
Published
Utilities for Spanish DNI
Downloads
28
Readme
🏷️ DNI Utils
Utilities to work with the Spanish DNI
🥪 Install
$ npm install @muxed/dni-utils
🎉 Usage
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)
🟢 Testing
Install the Jest dependencies if not in global
$ npm install
Run the tests
$ npm run test
🍰 Contributing
Please read CONTRIBUTING for details on our CODE OF CONDUCT, and the process for submitting pull requests.
☕️ Buy Me a Coffee
📑 License
MIT © MuXeD