2.0.2 • Published 2 years ago

@muxed/dni-utils v2.0.2

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

🏷️ 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

2.0.2

2 years ago

2.0.1

2 years ago

2.0.0

2 years ago

1.2.0

3 years ago

1.1.0

3 years ago

1.0.4

3 years ago

1.0.3

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago