@muxed/dni-utils
TypeScript icon, indicating that this package has built-in type declarations

2.0.2 • Public • Published

🏷️ DNI Utils

Utilities to work with the Spanish DNI

npm (scoped) npm bundle size (scoped) License GitHub Workflow Status

Discord

🥪 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

ko-fi

📑 License

MIT © MuXeD

⌨️ with ❤︎ by MuXeD

Readme

Keywords

Package Sidebar

Install

npm i @muxed/dni-utils

Weekly Downloads

6

Version

2.0.2

License

MIT

Unpacked Size

21.8 kB

Total Files

18

Last publish

Collaborators

  • muxed